本文整理汇总了Java中org.apache.zookeeper.Watcher.Event.EventType.NodeDeleted方法的典型用法代码示例。如果您正苦于以下问题:Java EventType.NodeDeleted方法的具体用法?Java EventType.NodeDeleted怎么用?Java EventType.NodeDeleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.Watcher.Event.EventType
的用法示例。
在下文中一共展示了EventType.NodeDeleted方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processDataOrChildChange
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
private void processDataOrChildChange(WatchedEvent event) {
final String path = event.getPath();
if (event.getType() == EventType.NodeChildrenChanged || event.getType() == EventType.NodeCreated || event.getType() == EventType.NodeDeleted) {
Set<IZkChildListener> childListeners = _childListener.get(path);
if (childListeners != null && !childListeners.isEmpty()) {
fireChildChangedEvents(path, childListeners);
}
}
if (event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted || event.getType() == EventType.NodeCreated) {
Set<IZkDataListener> listeners = _dataListener.get(path);
if (listeners != null && !listeners.isEmpty()) {
fireDataChangedEvents(event.getPath(), listeners);
}
}
}
示例2: process
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
if (!closed) {
try {
if (event.getType() != EventType.NodeDeleted) {
Stat s = zooKeeper.exists(nodePath, this);
if (s != null) {
zookeeper.getChildren(nodePath, this);
}
}
} catch (Exception e) {
LoggerFactory.getLogger().error(
"Error occured re-adding node watcherfor node "
+ nodePath, e);
}
nodeListener.processEvent(event.getPath(), event.getType()
.name(), null);
}
}
示例3: processDataOrChildChange
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
private void processDataOrChildChange(WatchedEvent event) {
final String path = event.getPath();
if (event.getType() == EventType.NodeChildrenChanged || event.getType() == EventType.NodeCreated
|| event.getType() == EventType.NodeDeleted) {
Set<IZkChildListener> childListeners = _childListener.get(path);
if (childListeners != null && !childListeners.isEmpty()) {
fireChildChangedEvents(path, childListeners);
}
}
if (event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted
|| event.getType() == EventType.NodeCreated) {
Set<IZkDataListener> listeners = _dataListener.get(path);
if (listeners != null && !listeners.isEmpty()) {
fireDataChangedEvents(event.getPath(), listeners);
}
}
}
示例4: process
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
if (!closed) {
try {
if (event.getType() != EventType.NodeDeleted) {
Stat s = zooKeeper.exists(nodePath, this);
if (s != null) {
zookeeper.getChildren(nodePath, this);
}
}
} catch (Exception e) {
LoggerFactory.getLogger().error(
"Error occurred re-adding node watcherfor node "
+ nodePath, e);
}
nodeListener.processEvent(event.getPath(), event.getType()
.name(), null);
}
}
示例5: processDataOrChildChange
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
private void processDataOrChildChange(WatchedEvent event) {
final String path = event.getPath();
if (event.getType() == EventType.NodeChildrenChanged
|| event.getType() == EventType.NodeCreated
|| event.getType() == EventType.NodeDeleted) {
Set<IZkChildListener> childListeners = _childListener.get(path);
if (childListeners != null && !childListeners.isEmpty()) {
fireChildChangedEvents(path, childListeners);
}
}
if (event.getType() == EventType.NodeDataChanged
|| event.getType() == EventType.NodeDeleted
|| event.getType() == EventType.NodeCreated) {
Set<IZkDataListener> listeners = _dataListener.get(path);
if (listeners != null && !listeners.isEmpty()) {
fireDataChangedEvents(event.getPath(), listeners);
}
}
}
示例6: process
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
/**
* zookeeper节点的监视器
*/
public void process(WatchedEvent event) {
if (this.latch != null) {
if (event.getType() == EventType.NodeDeleted) {
this.latch.countDown();
}
}
}
示例7: process
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
logger.debug("Received event: " + event);
_zookeeperEventThread = Thread.currentThread();
boolean stateChanged = event.getPath() == null;
boolean znodeChanged = event.getPath() != null;
boolean dataChanged = event.getType() == EventType.NodeDataChanged || //
event.getType() == EventType.NodeDeleted || event.getType() == EventType.NodeCreated || //
event.getType() == EventType.NodeChildrenChanged;
getEventLock().lock();
try {
// We might have to install child change event listener if a new node was created
if (getShutdownTrigger()) {
logger.debug("ignoring event '{" + event.getType() + " | " + event.getPath() + "}' since shutdown triggered");
return;
}
if (stateChanged) {
processStateChanged(event);
}
if (dataChanged) {
processDataOrChildChange(event);
}
} finally {
if (stateChanged) {
getEventLock().getStateChangedCondition().signalAll();
// If the session expired we have to signal all conditions, because watches might have been removed and
// there is no guarantee that those
// conditions will be signaled at all after an Expired event
if (event.getState() == KeeperState.Expired) {
getEventLock().getZNodeEventCondition().signalAll();
getEventLock().getDataChangedCondition().signalAll();
// We also have to notify all listeners that something might have changed
fireAllEvents();
}
}
if (znodeChanged) {
getEventLock().getZNodeEventCondition().signalAll();
}
if (dataChanged) {
getEventLock().getDataChangedCondition().signalAll();
}
getEventLock().unlock();
logger.debug("Leaving process event");
}
}
示例8: process
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
public void process(WatchedEvent event) {
LOG.debug("Received event: " + event);
_zookeeperEventThread = Thread.currentThread();
boolean stateChanged = event.getPath() == null;
boolean znodeChanged = event.getPath() != null;
boolean dataChanged = event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted
|| event.getType() == EventType.NodeCreated
|| event.getType() == EventType.NodeChildrenChanged;
getEventLock().lock();
try {
// We might have to install child change event listener if a new node was created
if (getShutdownTrigger()) {
LOG.debug("ignoring event '{" + event.getType() + " | " + event.getPath()
+ "}' since shutdown triggered");
return;
}
if (stateChanged) {
processStateChanged(event);
}
if (dataChanged) {
processDataOrChildChange(event);
}
} finally {
if (stateChanged) {
getEventLock().getStateChangedCondition().signalAll();
// If the session expired we have to signal all conditions, because watches might have been removed and
// there is no guarantee that those
// conditions will be signaled at all after an Expired event
// TODO PVo write a test for this
if (event.getState() == KeeperState.Expired) {
getEventLock().getZNodeEventCondition().signalAll();
getEventLock().getDataChangedCondition().signalAll();
// We also have to notify all listeners that something might have changed
fireAllEvents();
}
}
if (znodeChanged) {
getEventLock().getZNodeEventCondition().signalAll();
}
if (dataChanged) {
getEventLock().getDataChangedCondition().signalAll();
}
getEventLock().unlock();
LOG.debug("Leaving process event");
}
}
示例9: process
import org.apache.zookeeper.Watcher.Event.EventType; //导入方法依赖的package包/类
@Override
public void process(WatchedEvent event) {
_zookeeperEventThread = Thread.currentThread();
boolean stateChanged = event.getPath() == null;
boolean znodeChanged = event.getPath() != null;
boolean dataChanged = event.getType() == EventType.NodeDataChanged
|| event.getType() == EventType.NodeDeleted
|| event.getType() == EventType.NodeCreated
|| event.getType() == EventType.NodeChildrenChanged;
getEventLock().lock();
try {
// We might have to install child change event listener if a new
// node was created
if (getShutdownTrigger()) {
logger.debug("ignoring event '{" + event.getType() + " | " + event.getPath() + "}' since shutdown triggered");
return;
}
if (stateChanged) {
processStateChanged(event);
}
if (dataChanged) {
processDataOrChildChange(event);
}
} finally {
if (stateChanged) {
getEventLock().getStateChangedCondition().signalAll();
// If the session expired we have to signal all conditions,
// because watches might have been removed and
// there is no guarantee that those
// conditions will be signaled at all after an Expired event
// TODO PVo write a test for this
if (event.getState() == KeeperState.Expired) {
getEventLock().getZNodeEventCondition().signalAll();
getEventLock().getDataChangedCondition().signalAll();
// We also have to notify all listeners that something might
// have changed
fireAllEvents();
}
}
if (znodeChanged) {
getEventLock().getZNodeEventCondition().signalAll();
}
if (dataChanged) {
getEventLock().getDataChangedCondition().signalAll();
}
getEventLock().unlock();
logger.debug("Leaving process event");
}
}