curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Boothe (JIRA)" <>
Subject [jira] [Updated] (CURATOR-85) curator-client ConnectionState uses deprecated Closeables method
Date Sun, 26 Jan 2014 19:04:38 GMT


Andy Boothe updated CURATOR-85:

    Attachment: curator-85.diff

Here's the patch we discussed. It creates a class {{org.apache.curator.utils.CloseableUtils}}
in {{curator-client}}, since that's the common dependency for all other Curator modules. The
class creates a method {{closeQuietly()}}, which has the implementation Jordan provided yesterday.
The patch then replaces all references to {{Closeables#closeQuietly()}} in master with references
to {{CloseableUtils#closeQuietly()}}. The patch was tested with {{mvn clean compile test}}
with the guava dependency set to 14.0.1 and 16.0 in the parent POM, and succeeded both times.
(This patch leaves the guava dependency at 14.0.1.)

This should be the final patch, but of course all feedback is welcome and I'm happy to make
any changes you need!

> curator-client ConnectionState uses deprecated Closeables method
> ----------------------------------------------------------------
>                 Key: CURATOR-85
>                 URL:
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Client, Framework, Recipes
>    Affects Versions: 2.2.0-incubating, 2.3.0
>            Reporter: Dave Cohrs
>         Attachments: curator-85.diff
> Tried to upgrade to guava-16 and started getting these errors from Curator on exit:
> Exception in thread "Thread-1" java.lang.NoSuchMethodError:;)V
> 	at org.apache.curator.ConnectionState.close(
> 	at org.apache.curator.CuratorZookeeperClient.close(
> 	at org.apache.curator.framework.imps.CuratorFrameworkImpl.close(
> 	at com.virident.fmc.service.AbstractService.closeCF(
> 	at com.virident.fmc.service.AbstractService.shutdown(
> 	at com.virident.fmc.service.AbstractService.access$000(
> 	at com.virident.fmc.service.AbstractService$
> 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

View raw message