Source:
public void processResult( int rawReturnCode, String notUsed, Object parent, String notUsed2) { KeeperException.Code returnCode = KeeperException.Code.get(rawReturnCode); ClaimedCoordinate claimedCoordinate = (ClaimedCoordinate) parent; LOG.fine("Claim callback with " + returnCode.name() + " " + claimedCoordinate.path + " synched: " + isSynchronizedWithZooKeeper.get() + " thread: " + this); switch (returnCode) { case OK: synchronized (lastStatusVersionMonitor) { lastStatusVersion = 0; } isSynchronizedWithZooKeeper.set(true); try { registerWatcher(); } catch (CloudnameException e) { LOG.fine("Failed register watcher after claim. Going to state out of sync: " + e.getMessage()); isSynchronizedWithZooKeeper.set(false); return; } catch (InterruptedException e) { LOG.fine("Interrupted while setting up new watcher. Going to state out of sync."); isSynchronizedWithZooKeeper.set(false); return; } LOG.info("Claimed processed ok, path: " + path); claimedCoordinate.sendEventToCoordinateListener( CoordinateListener.Event.COORDINATE_OK, "claimed"); return; case NODEEXISTS: if (isSynchronizedWithZooKeeper.get() && started.get()) { LOG.info("Everything is fine, ignoring NODEEXISTS message, path: " + path); return; } LOG.info("Claimed fail, node already exists, will retry: " + path); claimedCoordinate.sendEventToCoordinateListener( CoordinateListener.Event.NOT_OWNER, "Node already exists."); LOG.info("isSynchronizedWithZooKeeper: " + isSynchronizedWithZooKeeper.get()); checkVersion.set(true); return; case NONODE: LOG.info("Could not claim due to missing coordinate, path: " + path); claimedCoordinate.sendEventToCoordinateListener( CoordinateListener.Event.NOT_OWNER, "No node on claiming coordinate: " + returnCode.name()); return; default: claimedCoordinate.sendEventToCoordinateListener( CoordinateListener.Event.NO_CONNECTION_TO_STORAGE, "Could not reclaim coordinate. Return code: " + returnCode.name()); return; } }

Target:
public void processResult( int rawReturnCode, String notUsed, Object parent, String notUsed2) { KeeperException.Code returnCode = KeeperException.Code.get(rawReturnCode); ClaimedCoordinate claimedCoordinate = (ClaimedCoordinate) parent; LOG.fine("Claim callback with " + returnCode.name() + " " + claimedCoordinate.path + " synched: " + isSynchronizedWithZooKeeper.get() + " thread: " + this); switch (returnCode) { case OK: synchronized (lastStatusVersionMonitor) { lastStatusVersion = 0; } isSynchronizedWithZooKeeper.set(true); try { registerWatcher(); } catch (CloudnameException e) { LOG.fine("Failed register watcher after claim. Going to state out of sync: " + e.getMessage()); isSynchronizedWithZooKeeper.set(false); return; } catch (InterruptedException e) { LOG.fine("Interrupted while setting up new watcher. Going to state out of sync."); isSynchronizedWithZooKeeper.set(false); return; } LOG.info("Claim processed ok, path: " + path); claimedCoordinate.sendEventToCoordinateListener( CoordinateListener.Event.COORDINATE_OK, "claimed"); return; case NODEEXISTS: if (isSynchronizedWithZooKeeper.get() && started.get()) { LOG.fine("Everything is fine, ignoring NODEEXISTS message, path: " + path); return; } LOG.info("Claimed fail, node already exists, will retry: " + path); claimedCoordinate.sendEventToCoordinateListener( CoordinateListener.Event.NOT_OWNER, "Node already exists."); LOG.info("isSynchronizedWithZooKeeper: " + isSynchronizedWithZooKeeper.get()); checkVersion.set(true); return; case NONODE: LOG.info("Could not claim due to missing coordinate, path: " + path); claimedCoordinate.sendEventToCoordinateListener( CoordinateListener.Event.NOT_OWNER, "No node on claiming coordinate: " + returnCode.name()); return; default: claimedCoordinate.sendEventToCoordinateListener( CoordinateListener.Event.NO_CONNECTION_TO_STORAGE, "Could not reclaim coordinate. Return code: " + returnCode.name()); return; } }