zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Zimmerman <jor...@jordanzimmerman.com>
Subject Re: How to catch NodeExistsException
Date Sat, 29 Aug 2015 02:23:14 GMT
FYI - Curator has its own mailing list at user@curator.apache.org

For Curator, I suggest you use this form:

client.create().creatingParentsIfNeeded().forPath(path). 

You shouldn’t ever need to catch the node exists exception in this 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@gmail.com) wrote:

I have this code using Curator:  

try  
{  
client.create().forPath(path);  
}  
catch (KeeperException.NodeExistsException ex)  
{  
LOG.debug("caught NodeExistsException");  
}  

The trouble is that it is never caught and zookeeper pollutes my production  
logs with what are probably harmless exceptions. I assume that my code  
executes just fine but later on the ZooKeeper server throws the exception  
as it does work in the background. Is there a way to gracefully catch those  
exceptions so they don't pile up in my production logs?  

I have tried in the past to fix my code so these exceptions are never  
thrown, but I have not found much in the documentation or on google on how  
to deal with these exceptions. Is it a known problem? I would love to solve  
these issues too if possible.  

--  
-Daniel  

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message