当前位置: 首页>>代码示例>>Java>>正文


Java EventType.NodeDeleted方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:lemonJun,项目名称:TakinRPC,代码行数:18,代码来源:ZkClient.java

示例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);
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:20,代码来源:ZooInspectorManagerImpl.java

示例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);
        }
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:20,代码来源:ZkClientx.java

示例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);
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:20,代码来源:ZooInspectorManagerImpl.java

示例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);
		}
	}
}
 
开发者ID:tiglabs,项目名称:jsf-core,代码行数:22,代码来源:ZkClient.java

示例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();
        }
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:11,代码来源:ZkDistributeLock.java

示例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");
    }
}
 
开发者ID:lemonJun,项目名称:TakinRPC,代码行数:49,代码来源:ZkClient.java

示例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");
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:51,代码来源:ZkClientx.java

示例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");
	}

}
 
开发者ID:tiglabs,项目名称:jsf-core,代码行数:55,代码来源:ZkClient.java


注:本文中的org.apache.zookeeper.Watcher.Event.EventType.NodeDeleted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。