當前位置: 首頁>>代碼示例>>Java>>正文


Java EventType.NodeDataChanged方法代碼示例

本文整理匯總了Java中org.apache.zookeeper.Watcher.Event.EventType.NodeDataChanged方法的典型用法代碼示例。如果您正苦於以下問題:Java EventType.NodeDataChanged方法的具體用法?Java EventType.NodeDataChanged怎麽用?Java EventType.NodeDataChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.zookeeper.Watcher.Event.EventType的用法示例。


在下文中一共展示了EventType.NodeDataChanged方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例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:tiglabs,項目名稱:jsf-core,代碼行數:22,代碼來源:ZkClient.java

示例4: process

import org.apache.zookeeper.Watcher.Event.EventType; //導入方法依賴的package包/類
@Override
public void process(WatchedEvent event) {
    if (event.getType() == EventType.NodeDataChanged) {
        synchronized(this) {
            changed = true;
            notifyAll();
        }
    }
}
 
開發者ID:maoling,項目名稱:fuck_zookeeper,代碼行數:10,代碼來源:Zab1_0Test.java

示例5: 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

示例6: 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

示例7: 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.NodeDataChanged方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。