accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Havanki (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ACCUMULO-2026) Consider implementing Closeable
Date Mon, 23 Dec 2013 16:19:52 GMT

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

Bill Havanki commented on ACCUMULO-2026:
----------------------------------------

It appears that {{ZooReader}} should implement {{Closeable}}, since it uses a connection to
ZooKeeper that should be closed when done with, and that is a source of data according to
the semantics of {{Closeable}}.

There is a wrinkle, though. The class uses {{ZooSession}} to acquire {{ZooKeeper}} (connection)
objects, and those objects are shareable across threads. It is unnecessary for {{ZooReader.close()}}
to close those objects all the time, since other threads may be using them. ({{ZooSession}}
handles reopening them.)

I propose making {{ZooSession}} smarter by implementing reference counting. {{ZooReader.close()}}
will only cause the underlying connection to be closed only if no other threads are using
it. It should prevent repeated closing and reopening of connections.

> Consider implementing Closeable
> -------------------------------
>
>                 Key: ACCUMULO-2026
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-2026
>             Project: Accumulo
>          Issue Type: Improvement
>            Reporter: Bill Havanki
>            Assignee: Bill Havanki
>
> ACCUMULO-2010 removed the implementation of {{Closeable}} by {{Instance}}, {{ZooCache}},
and {{ZooReader}} introduced in ACCUMULO-1984. This issue is to consider whether these classes,
and perhaps other key ones that provide a public {{close()}} method, should implement {{Closeable}},
and, if so, to add the changes such that relevant class instances are indeed closed correctly,
avoiding warnings at build time.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message