Examples of Watcher


Examples of org.apache.zookeeper.Watcher

        fake.disconnect(0);
        // TODO this breaks because the mocking causes the update not to propagate from one thread to another
        // very mysterious, but essentially undebuggable without some help from the author of jmockit.

        Watcher w = fake.expirePart1(0);

        // the other (unexpired) server should now know it is the only one
        assertEquals(1, Iterables.size(cs2.getCluster()));

        fake.expirePart2(w);
View Full Code Here

Examples of org.apache.zookeeper.Watcher

      throw new RuntimeException(e);
    }
  }

  public ZookeeperClusterStatus(String connectionStr, BlurConfiguration configuration) throws IOException {
    this(new ZooKeeper(connectionStr, 30000, new Watcher() {
      @Override
      public void process(WatchedEvent event) {

      }
    }), configuration);
View Full Code Here

Examples of org.apache.zookeeper.Watcher

  }

  public void register(final BlurShutdown shutdown, ZooKeeper zooKeeper) {
    this.shutdown = shutdown;
    this.zooKeeper = zooKeeper;
    zooKeeper.register(new Watcher() {
      @Override
      public void process(WatchedEvent event) {
        KeeperState state = event.getState();
        if (state == KeeperState.Expired) {
          LOG.fatal("Zookeeper session has [" + state + "] server process shutting down.");
View Full Code Here

Examples of org.apache.zookeeper.Watcher

   * Constructor
   * @param conf
   * @throws IOException
   */
  public ZooKeeperAuthenticator(HBaseConfiguration conf) throws IOException {
    this(conf, new ZooKeeperWrapper(conf, new Watcher() {
      public void process(WatchedEvent event) { }
    }));
    ensureExists(USERS_ZNODE_ROOT);
  }
View Full Code Here

Examples of org.apache.zookeeper.Watcher

    ZkConnection connection = ((ZkConnection) _zkClient.getConnection());
    ZooKeeper zookeeper = connection.getZookeeper();
    System.out.println("old sessionId= " + zookeeper.getSessionId());
    try
    {
      Watcher watcher = new Watcher(){
        @Override
        public void process(WatchedEvent event)
        {
          System.out.println("In New connection In process event:"+ event);
        }
View Full Code Here

Examples of org.apache.zookeeper.Watcher

    ZkConnection connection = ((ZkConnection) zkClient.getConnection());
    ZooKeeper curZookeeper = connection.getZookeeper();
    LOG.info("Before expiry. sessionId: " + Long.toHexString(curZookeeper.getSessionId()));

    Watcher watcher = new Watcher()
    {
      @Override
      public void process(WatchedEvent event)
      {
        LOG.info("Process watchEvent: " + event);
View Full Code Here

Examples of org.apache.zookeeper.Watcher

      InterruptedException
  {
    ZooKeeper oldZookeeper = zkConnection.getZookeeper();
    LOG.info("Old sessionId = " + oldZookeeper.getSessionId());

    Watcher watcher = new Watcher()
    {
      @Override
      public void process(WatchedEvent event)
      {
        LOG.info("In New connection, process event:" + event);
View Full Code Here

Examples of org.apache.zookeeper.Watcher

    zkClient.subscribeStateChanges(listener);
    ZkConnection connection = ((ZkConnection) zkClient.getConnection());
    ZooKeeper oldZookeeper = connection.getZookeeper();
    LOG.info("Old sessionId = " + oldZookeeper.getSessionId());

    Watcher watcher = new Watcher()
    {
      @Override
      public void process(WatchedEvent event)
      {
        LOG.info("In New connection, process event:" + event);
View Full Code Here

Examples of org.apache.zookeeper.Watcher

  @Override
  public void connect() throws IOException, InterruptedException {
    if (client == null) {
      if (logger.isDebugEnabled())
        logger.debug("connect(" + serverLocation + "): Connecting begin");
      client = new ZooKeeper(serverLocation, 5000, new Watcher() {
        @Override
        public void process(WatchedEvent event) {
        }
      });
      int waitCount = 0;
View Full Code Here

Examples of org.apache.zookeeper.Watcher

        // ZK ephemeral node for this Bookie.
        String zkBookieRegPath = this.bookieRegistrationPath
            + StringUtils.addrToString(getBookieAddress(conf));
        final CountDownLatch prevNodeLatch = new CountDownLatch(1);
        try{
            Watcher zkPrevRegNodewatcher = new Watcher() {
                @Override
                public void process(WatchedEvent event) {
                    // Check for prev znode deletion. Connection expiration is
                    // not handling, since bookie has logic to shutdown.
                    if (EventType.NodeDeleted == event.getType()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.