Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AC7018627 for ; Sat, 29 Aug 2015 02:23:24 +0000 (UTC) Received: (qmail 72525 invoked by uid 500); 29 Aug 2015 02:23:23 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 72475 invoked by uid 500); 29 Aug 2015 02:23:23 -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 72462 invoked by uid 99); 29 Aug 2015 02:23:23 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Aug 2015 02:23:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 968281AAB6F for ; Sat, 29 Aug 2015 02:23:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.98 X-Spam-Level: ** X-Spam-Status: No, score=2.98 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 608HDIFdIPkg for ; Sat, 29 Aug 2015 02:23:18 +0000 (UTC) Received: from mail-ig0-f173.google.com (mail-ig0-f173.google.com [209.85.213.173]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 2CC7720F6D for ; Sat, 29 Aug 2015 02:23:18 +0000 (UTC) Received: by igbuu8 with SMTP id uu8so819840igb.1 for ; Fri, 28 Aug 2015 19:23:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:message-id:in-reply-to:references :subject:mime-version:content-type; bh=zIxoMf2VwHJtZmCCT1Le1PSMfMBe5ss2efS4xoVut8Y=; b=UpSGyJ4Bw4U3ZnJNECa+NlyBWuHwvN/7Z/9PzdQ/CnyJBmuvkPSHzBKfkF/FpcSGOv fwoPWg0qMNqawN4mKjWrWtIEvLxXMyU+ZU4dMAZZrELfUc+g4q3KCsY3EXyUdyxVvNel qULkUXzWFA3KULLhozFNSB81S5R4HMPzhD5WRMME8cskODwBGIfP0azDrf7mqCN6kRat Ssx9MSN8wOq1pKuhDr2mylyXrmxxb6leuG0R3NGITlbLU0YmehDIS5HYNBWEfPayDfV0 t4XJVxzX4ZzcPYgGmGA4x5+2C0OqnhaBrM9uz8KFZxWcVba7mdWvCpQjwNcS9icPrLtr J21A== X-Gm-Message-State: ALoCoQmA6jJq6P8DwiHWV/Y3RIbaNYqJ1+GGgLCVNRtCpzRrM6smq8+Idi3lrII/1+ek2A+nDBWm X-Received: by 10.50.114.193 with SMTP id ji1mr5327219igb.97.1440814997638; Fri, 28 Aug 2015 19:23:17 -0700 (PDT) Received: from Jordans-MacBook-Pro.local ([190.140.97.103]) by smtp.gmail.com with ESMTPSA id 9sm3922625igz.4.2015.08.28.19.23.15 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Aug 2015 19:23:16 -0700 (PDT) Date: Fri, 28 Aug 2015 21:23:14 -0500 From: Jordan Zimmerman To: Daniel Kashtan , user@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: Re: How to catch NodeExistsException X-Mailer: Airmail (303) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="55e11792_157b092_15b" --55e11792_157b092_15b Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =46YI - Curator has its own mailing list at=C2=A0user=40curator.apache.or= g =46or Curator, I suggest you use this form: client.create().creatingParentsIfNeeded().forPath(path).=C2=A0 You shouldn=E2=80=99t ever need to catch the node exists exception in thi= s case. But, of course, it depends on your use case. Also, have a look at= how Curator implements various recipes for examples. -Jordan On August 28, 2015 at 4:47:41 PM, Daniel Kashtan (djkashtan=40gmail.com) = wrote: I have this code using Curator: =20 try =20 =7B =20 client.create().forPath(path); =20 =7D =20 catch (KeeperException.NodeExistsException ex) =20 =7B =20 LOG.debug(=22caught NodeExistsException=22); =20 =7D =20 The trouble is that it is never caught and zookeeper pollutes my producti= on =20 logs with what are probably harmless exceptions. I assume that my code =20 executes just fine but later on the ZooKeeper server throws the exception= =20 as it does work in the background. Is there a way to gracefully catch tho= se =20 exceptions so they don't pile up in my production logs=3F =20 I have tried in the past to fix my code so these exceptions are never =20 thrown, but I have not found much in the documentation or on google on ho= w =20 to deal with these exceptions. Is it a known problem=3F I would love to s= olve =20 these issues too if possible. =20 -- =20 -Daniel =20 --55e11792_157b092_15b--