Return-Path: Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: (qmail 53947 invoked from network); 11 Feb 2011 17:52:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Feb 2011 17:52:09 -0000 Received: (qmail 46420 invoked by uid 500); 11 Feb 2011 17:52:09 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 46255 invoked by uid 500); 11 Feb 2011 17:52:07 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 46242 invoked by uid 99); 11 Feb 2011 17:52:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Feb 2011 17:52:06 +0000 X-ASF-Spam-Status: No, hits=3.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tivv00@gmail.com designates 209.85.216.170 as permitted sender) Received: from [209.85.216.170] (HELO mail-qy0-f170.google.com) (209.85.216.170) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Feb 2011 17:51:59 +0000 Received: by qyk10 with SMTP id 10so3634918qyk.15 for ; Fri, 11 Feb 2011 09:51:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=76xIwFHim077tJZwDpOVI/Gng6xdyowGAxTnlX3nU4w=; b=ttuSVr/SRY2TGNhjMsgGtVTUwUTz1rRNNQ3mVMKp2EhWIdwLQdLULQI8okXiafKgiR 5BQZfseBa3BaP1egZfxJH/rQ3fs/k+GiOk69fUcJBbX0g9LmiUqJt/c411d6jB/8vodf 66/podhWXlAa+Agw7MSg4moYYQfwluVBZy4ig= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=GlBLChL1jYisiuJvB0F2cm7rH2rPZNeuHcD/keHxDK8KYibjk4AZztNK2hgbqxQtF6 pDIdp2vaZ/tovNur/JqJoX5KzDSa54zYUFcWKKrIu7KlhTm0JQIZzpjYJWa6hhJP6IBp Khi+RPgUj6CPqEDqw2QblsEt04MsgUsmiDpsY= MIME-Version: 1.0 Received: by 10.224.19.135 with SMTP id a7mr942548qab.153.1297446697990; Fri, 11 Feb 2011 09:51:37 -0800 (PST) Received: by 10.229.225.144 with HTTP; Fri, 11 Feb 2011 09:51:37 -0800 (PST) Date: Fri, 11 Feb 2011 19:51:37 +0200 Message-ID: Subject: ExecutorService over a zookeeper From: =?KOI8-U?B?96bUwcymyiD0yc3eydvJzg==?= To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=0015175cdd1e8c7afa049c0559ae X-Virus-Checked: Checked by ClamAV on apache.org --0015175cdd1e8c7afa049c0559ae Content-Type: text/plain; charset=ISO-8859-1 Hello. I am trying to implement distributed executor service over a zookeeper and encountered a problem I am not sure how to deal with. First of all, let me show you the way I am trying to implements this. I create a number of prefix nodes for different messages belonging to the same job: Job, Queued, Reserved, Result When someone want to submit a job, he creates EPHEMERAL_SEQUENTIAL node under Job. The name returned will be job name, it will be used under every other prefix. All created nodes are EPHEMERAL Next sequence of OK processing operations looks like the next (S - submitter, P - processor) 1) S creates marker under Queued prefix 2) P creates marker under Reserved prefix 3) S removes marker under Queued prefix 4) P sets data under Result prefix 5) S gets data and removes all the nodes 6) P (after Job is removed) also removes all the nodes left This sheme supports both Processor problems (Reserved marker will disappear and Submitter will restart from (1)) and Submitter problems (as soon as Job dissappear, job is treated as cancelled by Processor). The problem is that I need to use watch for data removal. And exists watch for data removal may produce memory leaks if data was already removed on the time of exists call - the watch will be registered, but never triggered. And I don't see a way to clean-up watches on given path. While writing this e-mail I'we got a thought - I can use getData to set up a watch for removal. As far as I can see from client code, watch won't be set unless item does exist. Another problem is waiting for "Reserved" to appear - I need to set up exists watch, but there may be case when task is cancelled before it was taken by any processor. Should I make a fake "Reserved" item and then instantly remove it just to trigger the watch (and make it go to GC)? If so, can this be done as asynchronious calls without any callback? -- Best regards, Vitalii Tymchyshyn --0015175cdd1e8c7afa049c0559ae--