Package org.apache.zookeeper

Examples of org.apache.zookeeper.WatchedEvent


             * when the initial (or previously failed) connection cannot be re-established. This needs to be run through the retry policy
             * and callbacks need to get invoked, etc.
             */
            if ( e instanceof CuratorConnectionLossException )
            {
                WatchedEvent watchedEvent = new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.Disconnected, null);
                CuratorEvent event = new CuratorEventImpl(this, CuratorEventType.WATCHED, KeeperException.Code.CONNECTIONLOSS.intValue(), null, null, operationAndData.getContext(), null, null, null, watchedEvent, null);
                if ( checkBackgroundRetry(operationAndData, event) )
                {
                    queueOperation(operationAndData);
                }
View Full Code Here


                data.put(znode, Arrays.copyOf(content, content.length));

                String dir = znode.replaceAll("^(.*?)(/[^/]*)?$", "$1");
                if (watched.contains(dir)) {
                    for (Watcher watcher : watchers) {
                        watcher.process(new WatchedEvent(Watcher.Event.EventType.NodeChildrenChanged, Watcher.Event.KeeperState.SyncConnected, dir));
                    }
                }
                return znode;
            }
        }
View Full Code Here

                }
                data.remove(path);
                String dir = path.replaceAll("^(.*?)(/[^/]*)?$", "$1");
                if (watched.contains(dir)) {
                    for (Watcher watcher : watchers) {
                        watcher.process(new WatchedEvent(Watcher.Event.EventType.NodeChildrenChanged, Watcher.Event.KeeperState.SyncConnected, dir));
                    }
                }
            } else {
                throw new KeeperException.NoNodeException(path + " not found");
            }
View Full Code Here

        @Mock
        public synchronized void close() throws InterruptedException {
        }

        public void disconnect(int which) {
            watchers.get(which).process(new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.Disconnected, null));
        }
View Full Code Here

        public void disconnect(int which) {
            watchers.get(which).process(new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.Disconnected, null));
        }

        public void reconnect(int which) {
            watchers.get(which).process(new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.SyncConnected, null));
        }
View Full Code Here

            // notify all other nodes that node "which" has disappeared
            String dir = path.replaceAll("^(.*?)(/[^/]*)?$", "$1");
            if (watched.contains(dir)) {
                for (Watcher watcher : Lists.newArrayList(watchers)) {
                    watcher.process(new WatchedEvent(Watcher.Event.EventType.NodeChildrenChanged, Watcher.Event.KeeperState.SyncConnected, dir));
                }
            }
            return oldWatch;
        }
View Full Code Here

        }

        public void expirePart2(Watcher oldWatch) {
            // now process the expiration notice itself on node "which".  This happens after the other notification to
            // emulate what happens when a partitioned node comes back.
            oldWatch.process(new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.Expired, null));
        }
View Full Code Here

      @Override
      public void eventReceived(CuratorFramework _fk, CuratorEvent e)
          throws Exception {

        if (e.getType().equals(CuratorEventType.WATCHED)) {
          WatchedEvent event = e.getWatchedEvent();

          watcher.execute(event.getState(), event.getType(),
              event.getPath());
        }

      }
    });
View Full Code Here

      public synchronized void processWatchEvent(WatchedEvent event)
          throws Exception {

        if (forExpire) {
          // a hack... couldn't find a way to trigger expired event.
          WatchedEvent expriredEvent = new WatchedEvent(
              Watcher.Event.EventType.None,
              Watcher.Event.KeeperState.Expired, null);
          super.processWatchEvent(expriredEvent);
          forExpire = false;
          syncBarrier.await();
View Full Code Here

        c.replay();

        im.start();

        // simulate a zk callback
        WatchedEvent we = new WatchedEvent(EventType.NodeCreated, KeeperState.SyncConnected, node);
        im.process(we);

        c.verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.WatchedEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.