You’re right, totally missed that! I’ll give that a whirl. Thanks, -Terry
From: Jordan Zimmerman <[email protected]<mailto:[email protected]>> Date: Thursday, June 26, 2014 at 12:23 PM To: Terry Siu <[email protected]<mailto:[email protected]>>, "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: Re: InterProcessSemaphoreMutex and Reaper I forgot to mention, ChildReaper does what you want. -JZ From: Terry Siu [email protected]<mailto:[email protected]> Reply: [email protected]<mailto:[email protected]> [email protected]<mailto:[email protected]> Date: June 26, 2014 at 2:21:37 PM To: [email protected]<mailto:[email protected]> [email protected]<mailto:[email protected]> Subject: Re: InterProcessSemaphoreMutex and Reaper Thanks for the quick response! Any plans to eventually hide that detail from the user? Thanks, -Terry From: Jordan Zimmerman <[email protected]<mailto:[email protected]>> Date: Thursday, June 26, 2014 at 12:11 PM To: Terry Siu <[email protected]<mailto:[email protected]>>, "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> 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”. -JZ From: Terry Siu [email protected]<mailto:[email protected]> Reply: [email protected]<mailto:[email protected]>[email protected]<mailto:[email protected]> Date: June 26, 2014 at 1:58:10 PM To: [email protected]<mailto:[email protected]>[email protected]<mailto:[email protected]> Subject: InterProcessSemaphoreMutex and Reaper Hi, 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: /a/b/c/locks /a/b/c/leases 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 { lock.release(); } } 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. Thanks, -Terry
