Return-Path: Delivered-To: apmail-hadoop-zookeeper-user-archive@minotaur.apache.org Received: (qmail 89592 invoked from network); 24 Feb 2010 19:25:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Feb 2010 19:25:55 -0000 Received: (qmail 8080 invoked by uid 500); 24 Feb 2010 19:25:54 -0000 Delivered-To: apmail-hadoop-zookeeper-user-archive@hadoop.apache.org Received: (qmail 8038 invoked by uid 500); 24 Feb 2010 19:25:54 -0000 Mailing-List: contact zookeeper-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-user@hadoop.apache.org Delivered-To: mailing list zookeeper-user@hadoop.apache.org Received: (qmail 8028 invoked by uid 99); 24 Feb 2010 19:25:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2010 19:25:54 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [69.147.107.21] (HELO mrout2-b.corp.re1.yahoo.com) (69.147.107.21) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2010 19:25:43 +0000 Received: from SNV-EXPF01.ds.corp.yahoo.com (snv-expf01.ds.corp.yahoo.com [207.126.227.250]) by mrout2-b.corp.re1.yahoo.com (8.13.8/8.13.8/y.out) with ESMTP id o1OJNCLr093902 for ; Wed, 24 Feb 2010 11:23:15 -0800 (PST) DomainKey-Signature: a=rsa-sha1; s=serpent; d=yahoo-inc.com; c=nofws; q=dns; h=received:user-agent:date:subject:from:to:message-id: thread-topic:thread-index:in-reply-to:mime-version:content-type: content-transfer-encoding:x-originalarrivaltime; b=tyr2jl+jPLzi6+bm95n3XU14XMWtJ7Qx2GffaUVFIZN8duW5hhOgbG6FEjvzn8Is Received: from SNV-EXVS09.ds.corp.yahoo.com ([207.126.227.86]) by SNV-EXPF01.ds.corp.yahoo.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 24 Feb 2010 11:23:12 -0800 Received: from 10.73.146.106 ([10.73.146.106]) by SNV-EXVS09.ds.corp.yahoo.com ([207.126.227.84]) via Exchange Front-End Server snv-webmail.corp.yahoo.com ([207.126.227.59]) with Microsoft Exchange Server HTTP-DAV ; Wed, 24 Feb 2010 19:22:38 +0000 User-Agent: Microsoft-Entourage/12.20.0.090605 Date: Wed, 24 Feb 2010 11:22:38 -0800 Subject: Re: is there a good pattern for leases ? From: Mahadev Konar To: Message-ID: Thread-Topic: is there a good pattern for leases ? Thread-Index: Acq1hrm+tyVjgQ8GA0KN8seEPv6pOw== In-Reply-To: <8bc75ecf1002241109u249df8b6paf0a7bcf1a402ff9@mail.gmail.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-OriginalArrivalTime: 24 Feb 2010 19:23:12.0264 (UTC) FILETIME=[CE2AD880:01CAB586] X-Virus-Checked: Checked by ClamAV on apache.org I am not sure if I was clear enoguh in my last message. What is suggested was this: Create a client with a timeout of lets say 10 seconds! Zookeeper zk = new ZooKeeper(10000); (for brevity ignoring other parameters) Zk.create("/parent/ephemeral", data, EPEMERAL); //create a another thread that triggeers at 120 seconds On a trigger from this thread call zk.delete("/parent/ephemeral"); That's how lease can be done at the application side. Obviously your lease expires on a session close and other events as well, you need to be monitoring. Thanks mahadev On 2/24/10 11:09 AM, "Martin Waite" wrote: > Hi Mahadev, > > That is interesting. All I need to do is hold the connection for the > required time of a session that created an ephemeral node. > > Zookeeper is an interesting tool. > > Thanks again, > Martin > > On 24 February 2010 17:00, Mahadev Konar wrote: > >> Hi Martin, >> There isnt an inherent model for leases in the zookeeper library itself. >> To implement leases you will have to implement them at your application >> side >> with timeouts triggers (lease triggers) leading to session close at the >> client. >> >> >> Thanks >> mahadev >> >> >> On 2/24/10 3:40 AM, "Martin Waite" wrote: >> >>> Hi, >>> >>> Is there a good model for implementing leases in Zookeeper ? >>> >>> What I want to achieve is for a client to create a lock, and for that >> lock >>> to disappear two minutes later - regardless of whether the client is >> still >>> connected to zk. Like ephemeral nodes - but with a time delay. >>> >>> regards, >>> Martin >> >>