Java Code Examples for org.apache.zookeeper.Watcher.Event.EventType#NodeDataChanged

The following examples show how to use org.apache.zookeeper.Watcher.Event.EventType#NodeDataChanged . 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: ZkClient.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
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);
        }
    }
}
 
Example 2
Source File: FlinkServerRegister.java    From pinpoint with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void process(WatchedEvent event) {
    logger.info("Handle Zookeeper Event({}) started.", event);

    KeeperState state = event.getState();
    EventType eventType = event.getType();
    String path = event.getPath();

    if (state == KeeperState.SyncConnected || state == KeeperState.NoSyncConnected) {
        // when this happens, ephemeral node disappears
        // reconnects automatically, and process gets notified for all events
        if (eventType == EventType.NodeChildrenChanged) {
            logger.info("zookeeper Event occurs : NodeChildrenChanged event");
        } else if (eventType == EventType.NodeDeleted) {
            logger.info("zookeeper Event occurs : NodeDeleted");
        } else if (eventType == EventType.NodeDataChanged) {
            logger.info("zookeeper Event occurs : NodeDataChanged");
        }
    }
    logger.info("Handle Zookeeper Event({}) completed.", event);
}
 
Example 3
Source File: ZkClient.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
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);
        }
    }
}
 
Example 4
Source File: ZkClient.java    From helix with Apache License 2.0 6 votes vote down vote up
private void processDataOrChildChange(WatchedEvent event, long notificationTime) {
  final String path = event.getPath();
  final boolean pathExists = event.getType() != EventType.NodeDeleted;
  if (EventType.NodeDeleted == event.getType()) {
    LOG.debug("Event NodeDeleted: {}", 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()) {
      // TODO recording child changed event propagation latency as well. Note this change will
      // introduce additional ZK access.
      fireChildChangedEvents(path, childListeners, pathExists);
    }
  }

  if (event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted
      || event.getType() == EventType.NodeCreated) {
    Set<IZkDataListenerEntry> listeners = _dataListener.get(path);
    if (listeners != null && !listeners.isEmpty()) {
      fireDataChangedEvents(event.getPath(), listeners, OptionalLong.of(notificationTime),
          pathExists);
    }
  }
}
 
Example 5
Source File: ZkClient.java    From TakinRPC with Apache License 2.0 6 votes vote down vote up
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);
        }
    }
}
 
Example 6
Source File: ZKWatcherProcess.java    From zkclient with Apache License 2.0 6 votes vote down vote up
/**
 * 处理数据改变事件
 * @param event 
 * @return void
 */
public void processNodeChanged(final WatchedEvent event){
    final String path = event.getPath();
    final EventType eventType = event.getType();
    final Set<ZKListener> listeners = client.getNodeListenerMap().get(path);
    if (listeners == null || listeners.isEmpty()) {
        return;
    }
    
    //如果listeners中如果有ZKChildDataListener类型的监听器,
    //证明是此节点是某个节点的子节点,并监听此节点的数据变化
    //这里要单独拿出来,用于触发ZKChildDataListener
    final Set<ZKListener> childDataChangeListners = new CopyOnWriteArraySet<>();
    final Set<ZKListener> nodeListners = new CopyOnWriteArraySet<>();
    
    classifyListeners(listeners,nodeListners,childDataChangeListners);
    
    //提交事件监听进行处理
    submitNodeEvent(nodeListners,childDataChangeListners,path,eventType);
    
    //当前节点作为子节点数据变化
    if(eventType == EventType.NodeDataChanged){
        //提交事件监听进行处理
        submitChildDataEvent(childDataChangeListners,path,eventType);
    }
}
 
Example 7
Source File: ZKNodeListener.java    From zkclient with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(String path, EventType eventType, Object data) throws Exception {
    
    if (eventType == EventType.NodeCreated) {
        handleDataCreated(path,data);
    }
    
    if (eventType == EventType.NodeDataChanged) {
        handleDataChanged(path,data);
    }
    
    if(eventType == EventType.NodeDeleted ){
        handleDataDeleted(path);
    }
    
    if(eventType == eventType.None){
        handleSessionExpired(path);
    }
}
 
Example 8
Source File: ZookeeperClusterDataManager.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void process(WatchedEvent event) {
    logger.info("Handle Zookeeper Event({}) started.", event);

    KeeperState state = event.getState();
    EventType eventType = event.getType();
    String path = event.getPath();

    // when this happens, ephemeral node disappears
    // reconnects automatically, and process gets notified for all events
    boolean result = false;
    if (state == KeeperState.SyncConnected || state == KeeperState.NoSyncConnected) {
        if (eventType == EventType.NodeChildrenChanged) {
            result = handleNodeChildrenChanged(path);
        } else if (eventType == EventType.NodeDeleted) {
            result = handleNodeDeleted(path);
        } else if (eventType == EventType.NodeDataChanged) {
            result = handleNodeDataChanged(path);
        }
    }

    if (result) {
        logger.info("Handle Zookeeper Event({}) completed.", event);
    } else {
        logger.info("Handle Zookeeper Event({}) failed.", event);
    }
}
 
Example 9
Source File: NodeWatcher.java    From disconf with Apache License 2.0 4 votes vote down vote up
/**
 * 回调函数
 */
@Override
public void process(WatchedEvent event) {

    //
    // 结点更新时
    //
    if (event.getType() == EventType.NodeDataChanged) {

        try {

            LOGGER.info("============GOT UPDATE EVENT " + event.toString() + ": (" + monitorPath + "," + keyName
                    + "," + disConfigTypeEnum.getModelName() + ")======================");

            // 调用回调函数, 回调函数里会重新进行监控
            callback();

        } catch (Exception e) {

            LOGGER.error("monitor node exception. " + monitorPath, e);
        }
    }

    //
    // 结点断开连接,这时不要进行处理
    //
    if (event.getState() == KeeperState.Disconnected) {

        if (!debug) {
            LOGGER.warn("============GOT Disconnected EVENT " + event.toString() + ": (" + monitorPath + ","
                    + keyName + "," + disConfigTypeEnum.getModelName() + ")======================");
        } else {
            LOGGER.debug("============DEBUG MODE: GOT Disconnected EVENT " + event.toString() + ": (" +
                    monitorPath +
                    "," +
                    keyName +
                    "," + disConfigTypeEnum.getModelName() + ")======================");
        }
    }

    //
    // session expired,需要重新关注哦
    //
    if (event.getState() == KeeperState.Expired) {

        if (!debug) {

            LOGGER.error("============GOT Expired  " + event.toString() + ": (" + monitorPath + "," + keyName
                    + "," + disConfigTypeEnum.getModelName() + ")======================");

            // 重新连接
            ZookeeperMgr.getInstance().reconnect();

            callback();
        } else {
            LOGGER.debug("============DEBUG MODE: GOT Expired  " + event.toString() + ": (" + monitorPath + ","
                    + "" + keyName + "," + disConfigTypeEnum.getModelName() + ")======================");
        }
    }
}
 
Example 10
Source File: ZkClient.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
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
            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");
    }
}
 
Example 11
Source File: ZkClient.java    From helix with Apache License 2.0 4 votes vote down vote up
@Override
public void process(WatchedEvent event) {
  long notificationTime = System.currentTimeMillis();
  if (LOG.isDebugEnabled()) {
    LOG.debug("Received event: " + event);
  }
  _zookeeperEventThread = Thread.currentThread();

  boolean stateChanged = event.getPath() == null;
  boolean sessionExpired = stateChanged && event.getState() == KeeperState.Expired;
  boolean znodeChanged = event.getPath() != null;
  boolean dataChanged =
      event.getType() == EventType.NodeDataChanged || event.getType() == EventType.NodeDeleted
          || event.getType() == EventType.NodeCreated
          || event.getType() == EventType.NodeChildrenChanged;
  if (event.getType() == EventType.NodeDeleted) {
    LOG.debug("Path {} is deleted", event.getPath());
  }

  getEventLock().lock();
  try {
    // We might have to install child change event listener if a new node was created
    if (getShutdownTrigger()) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("ignoring event '{" + event.getType() + " | " + event.getPath()
            + "}' since shutdown triggered");
      }
      return;
    }
    if (stateChanged) {
      processStateChanged(event);
    }
    if (dataChanged) {
      processDataOrChildChange(event, notificationTime);
    }
  } 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();
      }
    }
    if (znodeChanged) {
      getEventLock().getZNodeEventCondition().signalAll();
    }
    if (dataChanged) {
      getEventLock().getDataChangedCondition().signalAll();
    }
    getEventLock().unlock();

    // update state change counter.
    recordStateChange(stateChanged, dataChanged, sessionExpired);

    if (LOG.isDebugEnabled()) {
      LOG.debug("Leaving process event");
    }
  }
}
 
Example 12
Source File: TestPersistentEphemeralNode.java    From curator with Apache License 2.0 4 votes vote down vote up
private static Trigger dataChanged()
{
    return new Trigger(EventType.NodeDataChanged);
}
 
Example 13
Source File: TestPersistentEphemeralNode.java    From curator with Apache License 2.0 4 votes vote down vote up
private static Trigger deletedOrSetData()
{
    return new Trigger(Event.EventType.NodeDeleted, EventType.NodeDataChanged);
}
 
Example 14
Source File: TestPersistentEphemeralNode.java    From curator with Apache License 2.0 4 votes vote down vote up
@Test
public void testSetDataWhenDisconnected() throws Exception
{
    CuratorFramework curator = newCurator();

    byte[] initialData = "Hello World".getBytes();
    byte[] updatedData = "Updated".getBytes();

    PersistentEphemeralNode node = new PersistentEphemeralNode(curator, PersistentEphemeralNode.Mode.EPHEMERAL, PATH, initialData);
    try
    {
        node.debugWaitMsForBackgroundBeforeClose.set(timing.forSleepingABit().milliseconds());
        node.start();
        node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
        assertTrue(Arrays.equals(curator.getData().forPath(node.getActualPath()), initialData));

        server.stop();

        final CountDownLatch dataUpdateLatch = new CountDownLatch(1);

        Watcher watcher = new Watcher()
        {
@Override
public void process(WatchedEvent event)
{
	if ( event.getType() == EventType.NodeDataChanged )
	{
		dataUpdateLatch.countDown();
	}
}
        };

        curator.getData().usingWatcher(watcher).inBackground().forPath(node.getActualPath());

        node.setData(updatedData);
        server.restart();

        assertTrue(timing.awaitLatch(dataUpdateLatch));

        assertTrue(Arrays.equals(curator.getData().forPath(node.getActualPath()), updatedData));
    }
    finally
    {
        CloseableUtils.closeQuietly(node);
    }
}
 
Example 15
Source File: NodeWatcher.java    From disconf with Apache License 2.0 4 votes vote down vote up
/**
 * 回调函数
 */
@Override
public void process(WatchedEvent event) {

    //
    // 结点更新时
    //
    if (event.getType() == EventType.NodeDataChanged) {

        try {

            LOGGER.info("============GOT UPDATE EVENT " + event.toString() + ": (" + monitorPath + "," + keyName
                    + "," + disConfigTypeEnum.getModelName() + ")======================");

            // 调用回调函数, 回调函数里会重新进行监控
            callback();

        } catch (Exception e) {

            LOGGER.error("monitor node exception. " + monitorPath, e);
        }
    }

    //
    // 结点断开连接,这时不要进行处理
    //
    if (event.getState() == KeeperState.Disconnected) {

        if (!debug) {
            LOGGER.warn("============GOT Disconnected EVENT " + event.toString() + ": (" + monitorPath + ","
                    + keyName + "," + disConfigTypeEnum.getModelName() + ")======================");
        } else {
            LOGGER.debug("============DEBUG MODE: GOT Disconnected EVENT " + event.toString() + ": (" +
                    monitorPath +
                    "," +
                    keyName +
                    "," + disConfigTypeEnum.getModelName() + ")======================");
        }
    }

    //
    // session expired,需要重新关注哦
    //
    if (event.getState() == KeeperState.Expired) {

        if (!debug) {

            LOGGER.error("============GOT Expired  " + event.toString() + ": (" + monitorPath + "," + keyName
                    + "," + disConfigTypeEnum.getModelName() + ")======================");

            // 重新连接
            ZookeeperMgr.getInstance().reconnect();

            callback();
        } else {
            LOGGER.debug("============DEBUG MODE: GOT Expired  " + event.toString() + ": (" + monitorPath + ","
                    + "" + keyName + "," + disConfigTypeEnum.getModelName() + ")======================");
        }
    }
}
 
Example 16
Source File: ZKWatcher.java    From zkclient with Apache License 2.0 4 votes vote down vote up
/**
 * 事件处理
 * @see org.apache.zookeeper.Watcher#process(org.apache.zookeeper.WatchedEvent)
 */
@Override
public void process(WatchedEvent event) {
    LOG.debug("ZooKeeper event is arrived [" + event+" ]...");
    EventType eventType = event.getType();
    //状态更新
    boolean stateChanged = event.getPath() == null;
    //节点相关的所有事件
    boolean znodeChanged = event.getPath() != null;
    
    //节点创建、删除和数据改变的事件
    boolean nodeChanged = eventType == EventType.NodeDataChanged 
            || eventType == EventType.NodeDeleted 
            || eventType == EventType.NodeCreated;
    
    //子节点数量改变相关的事件,包括节点创建和删除(都会影响子节点数量的变化),以及子节点数量的改变
    boolean childChanged = eventType == EventType.NodeDeleted 
            || eventType == EventType.NodeCreated
            || eventType == EventType.NodeChildrenChanged;
    
    client.acquireEventLock();
    try {
        if (client.getShutdownTrigger()) {
            LOG.debug("client will shutdown,ignore the event [" + eventType + " | " + event.getPath() + "]");
            return;
        }
        if (stateChanged) {//ZooKeeper状态改变的处理
            process.processStateChanged(event);
        }
        if (nodeChanged) {//节点改变事件处理,包括节点的创建、删除、数据改变
            process.processNodeChanged(event);
        }
        if (childChanged) {//造成子节点数量改变的事件的处理,包括节点的创建、删除、子节点数量改变
            process.processChildChanged(event);
        }
    } finally {
        if (stateChanged) {
            client.getEventLock().getStateChangedCondition().signalAll();
            // 在会话失效后,服务端会取消watch.
            // 如果在会话失效后与重连这段时间内有数据发生变化,监听器是无法监听到的,
            // 所以要唤醒等待的监听,并触发所有的监听事件
            if (event.getState() == KeeperState.Expired) {
                client.getEventLock().getNodeEventCondition().signalAll();
                client.getEventLock().getNodeOrChildChangedCondition().signalAll();
                
                // 通知所有的监听器,可能存在数据变化
                process.processAllNodeAndChildListeners(event);
            }
        }
        if (znodeChanged) {
            client.getEventLock().getNodeEventCondition().signalAll();
        }
        if (nodeChanged || childChanged) {
            client.getEventLock().getNodeOrChildChangedCondition().signalAll();
        }
        client.releaseEventLock();
    }
}
 
Example 17
Source File: ZkClient.java    From TakinRPC with Apache License 2.0 4 votes vote down vote up
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");
    }
}
 
Example 18
Source File: ZkClient.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
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
            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");
    }
}
 
Example 19
Source File: TestPersistentEphemeralNode.java    From xian with Apache License 2.0 4 votes vote down vote up
private static Trigger dataChanged()
{
    return new Trigger(EventType.NodeDataChanged);
}
 
Example 20
Source File: TestPersistentEphemeralNode.java    From xian with Apache License 2.0 4 votes vote down vote up
@Test
public void testSetDataWhenDisconnected() throws Exception
{
    CuratorFramework curator = newCurator();
    
    byte[] initialData = "Hello World".getBytes();
    byte[] updatedData = "Updated".getBytes();
         
    PersistentEphemeralNode node = new PersistentEphemeralNode(curator, PersistentEphemeralNode.Mode.EPHEMERAL, PATH, initialData);
    node.start();
    try
    {
        node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
        assertTrue(Arrays.equals(curator.getData().forPath(node.getActualPath()), initialData));
        
        server.stop();
        
        final CountDownLatch dataUpdateLatch = new CountDownLatch(1);
        
        Watcher watcher = new Watcher()
        {
@Override
public void process(WatchedEvent event)
{
	if ( event.getType() == EventType.NodeDataChanged )
	{
		dataUpdateLatch.countDown();
	}
}            	
        };
        
        curator.getData().usingWatcher(watcher).inBackground().forPath(node.getActualPath());
        
        node.setData(updatedData);
        server.restart();

        assertTrue(timing.awaitLatch(dataUpdateLatch));
                   
        assertTrue(Arrays.equals(curator.getData().forPath(node.getActualPath()), updatedData));
    }
    finally
    {
        node.close();
    }    	
}