Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B95D11F8B for ; Thu, 26 Jun 2014 19:26:29 +0000 (UTC) Received: (qmail 42901 invoked by uid 500); 26 Jun 2014 19:26:29 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 42859 invoked by uid 500); 26 Jun 2014 19:26:28 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 42849 invoked by uid 99); 26 Jun 2014 19:26:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jun 2014 19:26:28 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of terry.siu@smartfocus.com designates 146.101.78.197 as permitted sender) Received: from [146.101.78.197] (HELO eu-smtp-delivery-197.mimecast.com) (146.101.78.197) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jun 2014 19:26:25 +0000 Received: from smtp-out.emailvision.com (smtp-out.emailvision.com [193.25.198.227]) (Using TLS) by uk-mta-9.uk.mimecast.lan; Thu, 26 Jun 2014 20:26:00 +0100 Received: from FREX-CAS-02.Emailvision.com (172.24.36.18) by exchhub2.Emailvision.com (10.2.9.40) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 26 Jun 2014 21:25:54 +0200 Received: from FREX-MBX-03.Emailvision.com ([fe80::9d38:a58f:bd5b:66a]) by FREX-CAS-02.Emailvision.com ([::1]) with mapi id 14.03.0181.006; Thu, 26 Jun 2014 21:25:50 +0200 From: Terry Siu To: "user@curator.apache.org" Subject: Re: InterProcessSemaphoreMutex and Reaper Thread-Topic: InterProcessSemaphoreMutex and Reaper Thread-Index: AQHPkXB+5w+zvaSenEO49IA0/5K4zJuDoH+A//+NPwCAAHYNgP//i1IA Date: Thu, 26 Jun 2014 19:25:50 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.24.36.5] MIME-Version: 1.0 X-MC-Unique: hnLAguwaTk29m1AnPZKP1w-1 Content-Type: multipart/alternative; boundary="_000_CFD1C1B61455terrysiusmartfocuscom_" X-Virus-Checked: Checked by ClamAV on apache.org --_000_CFD1C1B61455terrysiusmartfocuscom_ Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable You=92re right, totally missed that! I=92ll give that a whirl. Thanks, -Terry From: Jordan Zimmerman > Date: Thursday, June 26, 2014 at 12:23 PM To: Terry Siu >, = "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 Reply: user@curator.apache.org user@curator= .apache.org Date: June 26, 2014 at 2:21:37 PM To: user@curator.apache.org user@curator.ap= ache.org Subject: Re: InterProcessSemaphoreMutex and Reaper Thanks for the quick response! Any plans to eventually hide that detail fro= m the user? Thanks, -Terry From: Jordan Zimmerman > Date: Thursday, June 26, 2014 at 12:11 PM To: Terry Siu >, = "user@curator.apache.org" > Subject: Re: InterProcessSemaphoreMutex and Reaper Reaper only works for 1 level. So you need to add to add both paths: =93/a/= b/c/locks=94 and =93/a/b/c/leases=94. -JZ From: Terry Siu terry.siu@smartfocus.com Reply: user@curator.apache.orguser@curator.= apache.org Date: June 26, 2014 at 1:58:10 PM To: user@curator.apache.orguser@curator.apa= che.org Subject: InterProcessSemaphoreMutex and Reaper Hi, Can I use the InterProcessSemaphoreMutex and Reaper together for ZK path cl= eanup? When I create the semaphore mutex with a path, say =93/a/b/c=94, two= ZK paths are created: /a/b/c/locks /a/b/c/leases I add the path =93/a/b/c=94 to my Reaper instance with a reaping threshold = of 1 minute. I then proceed to use my mutex: CuratorFramework client =3D /* Create the client */ Reaper reaper =3D new Reaper(client, 60000); InterProcessLock lock =3D new InterProcessSemaphoreMutex(client, =93/a/b/c= =94); reaper.addPath(=93/a/b/c=94, 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=92t the directory =91c=92 and everything under it be deleted by t= he Reaper? I experimented using an InterProcessMutex and the path gets dele= ted as expected. Thanks, -Terry --_000_CFD1C1B61455terrysiusmartfocuscom_ Content-Type: text/html; charset=WINDOWS-1252 Content-ID: <895B14DA881EA84FB692D0849507C232@Emailvision.com> Content-Transfer-Encoding: quoted-printable
You=92re right, totally missed that! I=92ll give that a whirl.

Thanks,
-Terry

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

I forgot to mention, ChildReaper does what you want.

-JZ


From: Terry Siu terry.siu@smartfocus.com
Reply: user@curator.apache.org user@curator.apache.org
Date: June 26, 2014 at 2:21:37 PM To: user@curator.apache.org user@curator.apache.org
Subject:  Re: InterProcessSemaphoreMutex a= nd Reaper

Thanks for the quick response! Any plans to eventually hide that detai= l from the user?

Thanks,
-Terry

From: Jordan Zimmerman <jor= dan@jordanzimmerman.com>
Date: Thursday, June 26, 2014 at 12= :11 PM
To: Terry Siu <terry.siu@smartfocus.com>, "user@curator.apache.org" <<= a href=3D"mailto:user@curator.apache.org">user@curator.apache.org> Subject: Re: InterProcessSemaphoreM= utex and Reaper

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

-JZ


From: Terry Siu terry.siu@smartfocus.com
Reply: user@curator.apache.orguser@curator.apache.org
Date: June 26, 2014 at 1:58:10 PM To: user@curator.apache.orguser@curator.apache.org
Subject:  InterProcessSemaphoreMutex and R= eaper

Hi,

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

/a/b/c/locks
/a/b/c/leases

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

CuratorFramework client =3D /* Create the client */
Reaper reaper =3D new Reaper(client, 60000);
InterProcessLock lock =3D new InterProcessSemaphoreMutex(client,= =93/a/b/c=94);
reaper.addPath(=93/a/b/c=94, 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 se= veral times, but I continue to see the locks and leases subdirectories stic= king around? Shouldn=92t the directory =91c=92 and everything under it be d= eleted by the Reaper? I experimented using an InterProcessMutex and the path gets deleted as expected.

Thanks,
-Terry

--_000_CFD1C1B61455terrysiusmartfocuscom_--