Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-85

curator-client ConnectionState uses deprecated Closeables method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.0-incubating, 2.3.0
    • 2.4.0
    • Client, Framework, Recipes
    • None

    Description

      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().

      Attachments

        1. curator-85.diff
          102 kB
          Andy Boothe

        Activity

          People

            randgalt Jordan Zimmerman
            davecohrs Dave Cohrs
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: