curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terry Siu <Terry....@smartfocus.com>
Subject Re: InterProcessSemaphoreMutex and Reaper
Date Thu, 26 Jun 2014 19:25:50 GMT
You’re right, totally missed that! I’ll give that a whirl.

Thanks,
-Terry

From: Jordan Zimmerman <jordan@jordanzimmerman.com<mailto:jordan@jordanzimmerman.com>>
Date: Thursday, June 26, 2014 at 12:23 PM
To: Terry Siu <terry.siu@smartfocus.com<mailto:terry.siu@smartfocus.com>>, "user@curator.apache.org<mailto:user@curator.apache.org>"
<user@curator.apache.org<mailto:user@curator.apache.org>>
Subject: Re: InterProcessSemaphoreMutex and Reaper

I forgot to mention, ChildReaper does what you want.

-JZ


From: Terry Siu terry.siu@smartfocus.com<mailto:terry.siu@smartfocus.com>
Reply: user@curator.apache.org<mailto:user@curator.apache.org> user@curator.apache.org<mailto:user@curator.apache.org>
Date: June 26, 2014 at 2:21:37 PM
To: user@curator.apache.org<mailto:user@curator.apache.org> user@curator.apache.org<mailto:user@curator.apache.org>
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 <jordan@jordanzimmerman.com<mailto:jordan@jordanzimmerman.com>>
Date: Thursday, June 26, 2014 at 12:11 PM
To: Terry Siu <terry.siu@smartfocus.com<mailto:terry.siu@smartfocus.com>>, "user@curator.apache.org<mailto:user@curator.apache.org>"
<user@curator.apache.org<mailto:user@curator.apache.org>>
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 terry.siu@smartfocus.com<mailto:terry.siu@smartfocus.com>
Reply: user@curator.apache.org<mailto:user@curator.apache.org>user@curator.apache.org<mailto:user@curator.apache.org>
Date: June 26, 2014 at 1:58:10 PM
To: user@curator.apache.org<mailto:user@curator.apache.org>user@curator.apache.org<mailto:user@curator.apache.org>
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




Mime
View raw message