[ 
https://issues.apache.org/jira/browse/FLINK-10125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16578008#comment-16578008
 ] 

Andrey Zagrebin commented on FLINK-10125:
-----------------------------------------

The *ByteArrayDataOutputView* is recently introduced short-hand in FLINK-10124. 
It is backed just by *byte[]*. It does not really need to be closed and its 
*close()* method is empty. I suggest we keep it under try/with/resources where 
it does not explode the code, like:
{code:java}
try (ByteArrayDataOutputView dov = new ByteArrayDataOutputView(1)) {
    ...
} 
{code}
or annotate it with *@SuppressWarnings("resource")* where it is declared as a 
field to not introduce more unnecessary closable paths in using it classes:
{code:java}
@SuppressWarnings("resource")
ByteArrayDataOutputView dov = new ByteArrayDataOutputView(1);{code}
see also @apiNote in *AutoClosable* interface.

> Unclosed ByteArrayDataOutputView in RocksDBMapState
> ---------------------------------------------------
>
>                 Key: FLINK-10125
>                 URL: https://issues.apache.org/jira/browse/FLINK-10125
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: vinoyang
>            Priority: Minor
>
> {code}
>       ByteArrayDataOutputView dov = new ByteArrayDataOutputView(1);
> {code}
> dov is used in a try block but it is not closed in case of Exception.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to