curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Zimmerman <>
Subject Re: InterProcessSemaphoreMutex and Reaper
Date Thu, 26 Jun 2014 19:23:25 GMT
I forgot to mention, ChildReaper does what you want.


From: Terry Siu
Date: June 26, 2014 at 2:21:37 PM
Subject:  Re: InterProcessSemaphoreMutex and Reaper  

Thanks for the quick response! Any plans to eventually hide that detail from the user?


From: Jordan Zimmerman <>
Date: Thursday, June 26, 2014 at 12:11 PM
To: Terry Siu <>, "" <>
Subject: Re: InterProcessSemaphoreMutex and Reaper

Reaper only works for 1 level. So you need to add to add both paths: “/a/b/c/locks” and “/a/b/c/leases”.


From: Terry Siu
Date: June 26, 2014 at 1:58:10 PM
Subject:  InterProcessSemaphoreMutex and Reaper


Can I use the InterProcessSemaphoreMutex and Reaper together for ZK path cleanup? When I create
the semaphore mutex with a path, say “/a/b/c”, two ZK paths are created:


I add the path “/a/b/c” to my Reaper instance with a reaping threshold of 1 minute. I
then proceed to use my mutex:

CuratorFramework client = /* Create the client */
Reaper reaper = new Reaper(client, 60000);
InterProcessLock lock = new InterProcessSemaphoreMutex(client, “/a/b/c”);
reaper.addPath(“/a/b/c”, Reaper.Mode.REAP_UNTIL_GONE);
if (lock.acquire(0, TimeUnit.SECONDS)) {
  try {  
    /* Execute critical section */
  } finally {
} else {
  /* Log it */

After the above code finishes, I notice the reaper kicking in several times, but I continue
to see the locks and leases subdirectories sticking around? Shouldn’t the directory ‘c’
and everything under it be deleted by the Reaper? I experimented using an InterProcessMutex
and the path gets deleted as expected.


View raw message