curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Boothe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-85) curator-client ConnectionState uses deprecated Closeables method
Date Sat, 25 Jan 2014 18:12:38 GMT

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

Andy Boothe commented on CURATOR-85:
------------------------------------

Thanks for the quick response, Jordan. I'll see if I can't get a patch turned around in the
next day or two.

To be minimally disruptive to projects currently using Curator, it looks like The Right Thing
is not to bump the version of the guava dependency, but rather to port calls from Closeables#closeQuietly(Closeable)
to Closeables#close(Closeable,boolean), which is already available in 14.1 and still available
(and not @deprecated) in 16.0. 

However, if you'd prefer I bump to 15.0 or 16.0, it shouldn't be hard to do that, either.
I see an issue (CURATOR-69) to bump to 15.0; it'd be pretty easy to handle that in this patch,
too.

Unless you say otherwise, I'll keep to 14.0.1.

> curator-client ConnectionState uses deprecated Closeables method
> ----------------------------------------------------------------
>
>                 Key: CURATOR-85
>                 URL: https://issues.apache.org/jira/browse/CURATOR-85
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Client, Framework, Recipes
>    Affects Versions: 2.2.0-incubating, 2.3.0
>            Reporter: Dave Cohrs
>
> Tried to upgrade to guava-16 and started getting these errors from Curator on exit:
> Exception in thread "Thread-1" java.lang.NoSuchMethodError: com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V
> 	at org.apache.curator.ConnectionState.close(ConnectionState.java:109)
> 	at org.apache.curator.CuratorZookeeperClient.close(CuratorZookeeperClient.java:196)
> 	at org.apache.curator.framework.imps.CuratorFrameworkImpl.close(CuratorFrameworkImpl.java:284)
> 	at com.virident.fmc.service.AbstractService.closeCF(AbstractService.java:199)
> 	at com.virident.fmc.service.AbstractService.shutdown(AbstractService.java:215)
> 	at com.virident.fmc.service.AbstractService.access$000(AbstractService.java:31)
> 	at com.virident.fmc.service.AbstractService$1.run(AbstractService.java:98)
> tail: /var/lib/vgccluster/manager.out: file truncated
> Investigation shows this code:
>     public void close() throws IOException
>     {
>         log.debug("Closing");
>         Closeables.closeQuietly(ensembleProvider);
> This closeQuietly() method is deprecated as of guava 14, and it gone in guava 16.  The
2-parameter closeQuietly() needs to be called, eg:
>         Closeables.closeQuietly(ensembleProvider, true);
> Curator master source still seems to have this bug.  The 2-parameter closeQuietly is
already be available in guava-14 and the 1-parameter version is marked decorated as deprecated
in that release which should have generated deprecation warnings.
> A visual inspection of the various curator projects shows that this deprecated API is
used in many places.  They all should be corrected to use the 2-parameter Closeables.closeQuietly().



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

Mime
View raw message