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

Curator does not run sync callback on supplied Executor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.9.1, 3.1.0
    • Framework
    • None

    Description

      It appears that Apache Curator does not execute the sync callback on the supplied Executor in at least one case.

      This issue described is currently (2015-10-14) present in master

      Sample code outline:

      BackgroundCallback myCallback = ...;
      Executor myExecutor = ...;
      String myZkPath = ...;
      CuratorFramework myCurator = ...;
      curator.sync()
        .inBackground(myCallback, myExecutor)
        .forPath(myZkPath);
      

      This should execute myCallback on the myExecutor executor, it does not and instead executes myCallback on what is presumeably a ZooKeeper thread.

      Looking at the org.apache.curator.framework.imps.SyncBuilderImpl code we have

      public Pathable inBackground(BackgroundCallback callback, Executor executor) {
        backgrounding = new Backgrounding(callback, executor);
        return this;
      }
      

      However the only matching constructor in org.apache.curator.framework.imps.Backgrounding is Backgrounding(BackgroundCallback callback, Object context)

      It seems that SyncBuilderImpl#inBackground(BackgroundCallback,Executor) should be using the following Backgrounding constructor Backgrounding(CuratorFrameworkImpl, BackgroundCallback, Executor)

      A workaround looks to be using the following method and passing a null context object:

        public Pathable inBackground(BackgroundCallback callback, Object context, Executor executor)
      

      A very quick skim suggests that it is only SyncBuilderImpl that has the issue the other org.apache.curator.framework.imps.*BuilderImpl classes seem to be fine.

      Attachments

        Activity

          People

            cammckenzie Cam McKenzie
            wallaceg-tp Glen Wallace
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: