Java Code Examples for org.apache.curator.framework.api.CuratorEvent#getName()
The following examples show how to use
org.apache.curator.framework.api.CuratorEvent#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PersistentNode.java From xian with Apache License 2.0 | 6 votes |
private void processBackgroundCallbackClosedState(CuratorEvent event) { String path = null; if ( event.getResultCode() == KeeperException.Code.NODEEXISTS.intValue() ) { path = event.getPath(); } else if ( event.getResultCode() == KeeperException.Code.OK.intValue() ) { path = event.getName(); } if ( path != null ) { try { client.delete().guaranteed().inBackground().forPath(path); } catch ( Exception e ) { log.error("Could not delete node after close", e); } } }
Example 2
Source File: PersistentNode.java From curator with Apache License 2.0 | 6 votes |
private void processBackgroundCallbackClosedState(CuratorEvent event) { String path = null; if ( event.getResultCode() == KeeperException.Code.NODEEXISTS.intValue() ) { path = event.getPath(); } else if ( event.getResultCode() == KeeperException.Code.OK.intValue() ) { path = event.getName(); } if ( path != null ) { try { client.delete().guaranteed().inBackground().forPath(path); } catch ( Exception e ) { log.error("Could not delete node after close", e); } } }
Example 3
Source File: PersistentNode.java From xian with Apache License 2.0 | 5 votes |
private void processBackgroundCallback(CuratorEvent event) throws Exception { String path = null; boolean nodeExists = false; if ( event.getResultCode() == KeeperException.Code.NODEEXISTS.intValue() ) { path = event.getPath(); nodeExists = true; } else if ( event.getResultCode() == KeeperException.Code.OK.intValue() ) { path = event.getName(); } else if ( event.getResultCode() == KeeperException.Code.NOAUTH.intValue() ) { log.warn("Client does not have authorisation to write node at path {}", event.getPath()); authFailure.set(true); return; } if ( path != null ) { authFailure.set(false); nodePath.set(path); watchNode(); if ( nodeExists ) { client.setData().inBackground(setDataCallback).forPath(getActualPath(), getData()); } else { initialisationComplete(); } } else { createNode(); } }
Example 4
Source File: PersistentNode.java From curator with Apache License 2.0 | 5 votes |
private void processBackgroundCallback(CuratorEvent event) throws Exception { String path = null; boolean nodeExists = false; if ( event.getResultCode() == KeeperException.Code.NODEEXISTS.intValue() ) { path = event.getPath(); nodeExists = true; } else if ( event.getResultCode() == KeeperException.Code.OK.intValue() ) { path = event.getName(); } else if ( event.getResultCode() == KeeperException.Code.NOAUTH.intValue() ) { log.warn("Client does not have authorisation to create node at path {}", event.getPath()); authFailure.set(true); return; } if ( path != null ) { authFailure.set(false); nodePath.set(path); watchNode(); if ( nodeExists ) { client.setData().inBackground(setDataCallback).forPath(getActualPath(), getData()); } else { initialisationComplete(); notifyListeners(); } } else { createNode(); } }