accumulo-notifications mailing list archives

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


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:
>             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

View raw message