Package org.apache.zookeeper

Examples of org.apache.zookeeper.Watcher$Event


    MigrationCleanupThread migrationCleanupThread = new MigrationCleanupThread();
    migrationCleanupThread.start();
   
    tserverSet.startListeningForTabletServerChanges();
   
    ZooReaderWriter.getInstance().getChildren(zroot + Constants.ZRECOVERY, new Watcher() {
      @Override
      public void process(WatchedEvent event) {
        nextEvent.event("Noticed recovery changes", event.getType());
        try {
          // watcher only fires once, add it back
View Full Code Here


        // 异步删除
        client.delete().inBackground().forPath("/head");

        // 注册观察者,当节点变动时触发
        client.getData().usingWatcher(new Watcher() {
            @Override
            public void process(WatchedEvent event) {
                System.out.println("node is changed");
            }
        }).inBackground().forPath("/test");
View Full Code Here

  final List<String> hosts = new ArrayList<String>();
 
  public ZooSpanClient(String keepers, final String path, String host, String service, long millis) throws IOException, KeeperException, InterruptedException {
    super(host, service, millis);
    this.path = path;
    zoo = new ZooKeeper(keepers, 30 * 1000, new Watcher() {
      @Override
      public void process(WatchedEvent event) {
        try {
          if (zoo != null) {
            updateHosts(path, zoo.getChildren(path, null));
View Full Code Here

    alwaysRetryWrites = conf.getBoolean("fs.ha.retrywrites", false);
    // The actual name of the filesystem e.g. dfs.data.xxx.com:9000
    this.logicalName = name;
    this.conf = conf;
    // Create AvatarZooKeeperClient
    Watcher watcher = null;
    if (watchZK) {
      watcher = new ZooKeeperFSWatcher();
    }
    zk = new CachingAvatarZooKeeperClient(conf, watcher);
    cacheZKData = zk.isCacheEnabled();
View Full Code Here

      prev = child;
    }
   
    final String lockToWatch = path + "/" + prev;
   
    Stat stat = zooKeeper.getStatus(path + "/" + prev, new Watcher() {
     
      @Override
      public void process(WatchedEvent event) {
       
        if (event.getType() == EventType.NodeDeleted && event.getPath().equals(lockToWatch)) {
View Full Code Here

    lockWasAcquired = false;
   
    try {
      final String asyncLockPath = zooKeeper.putEphemeralSequential(path + "/" + LOCK_PREFIX, data);
     
      Stat stat = zooKeeper.getStatus(asyncLockPath, new Watcher() {
       
        private void failedToAcquireLock(){
          lw.failedToAcquireLock(new Exception("Lock deleted before acquired"));
          asyncLock = null;
        }
View Full Code Here

      throws IOException, KeeperException, InterruptedException, ServiceException {
    final RecoverableZooKeeper recoverableZk = Mockito
        .mock(RecoverableZooKeeper.class);
    AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(
        this.server, this.serverManager);
    Watcher zkw = new ZooKeeperWatcher(HBaseConfiguration.create(), "unittest",
        null) {
      public RecoverableZooKeeper getRecoverableZooKeeper() {
        return recoverableZk;
      }
    };
View Full Code Here

      InterruptedException, KeeperException {
    final BlurConfiguration localConf = getBlurConfiguration(configuration);
    int shardPort = localConf.getInt(BLUR_SHARD_BIND_PORT, 40020);
    String nodeNameHostname = ThriftServer.getNodeName(configuration, BLUR_SHARD_HOSTNAME);
    String nodeName = nodeNameHostname + ":" + (shardPort + shardServer);
    ZooKeeper zk = new ZooKeeperClient(getZkConnectionString(), 30000, new Watcher() {
      @Override
      public void process(WatchedEvent event) {

      }
    });
View Full Code Here

      } catch (InterruptedException e) {
        LOG.error(e);
        throw new RuntimeException(e);
      }
      try {
        ZooKeeper zk = new ZooKeeper(zkConnectionString, 30000, new Watcher() {
          @Override
          public void process(WatchedEvent event) {

          }
        });
View Full Code Here

    MiniCluster.shutdownZooKeeper();
  }

  @Before
  public void setup() throws KeeperException, InterruptedException, IOException {
    zooKeeper = new ZooKeeperClient(MiniCluster.getZkConnectionString(), 30000, new Watcher() {
      @Override
      public void process(WatchedEvent event) {

      }
    });
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.Watcher$Event

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.