Package com.alibaba.wasp.zookeeper

Examples of com.alibaba.wasp.zookeeper.ZooKeeperWatcher


    return clusterId.toString();
  }

  @Override
  public String getZookeeperQuorum() {
    ZooKeeperWatcher zk = master.getZooKeeperWatcher();
    if (zk == null) {
      return "";
    }
    return zk.getQuorum();
  }
View Full Code Here


      this.connection = null;
      return;
    }
    this.connection = FConnectionManager.getConnection(conf);
    this.configuration = conf;
    this.zooKeeper = new ZooKeeperWatcher(configuration, FCLIENT + ":", this);
    this.fserverTracker = new FClientFServerTracker(zooKeeper);
    try {
      this.fserverTracker.start();
    } catch (KeeperException e) {
      throw new IOException(e);
View Full Code Here

   */
  public static boolean clear(Configuration conf) {
    Configuration tempConf = new Configuration(conf);
    tempConf.setInt("zookeeper.recovery.retry", 0);

    ZooKeeperWatcher zkw;
    try {
      zkw = new ZooKeeperWatcher(tempConf, "clean znode for master",
          new Abortable() {
            @Override
            public void abort(String why, Throwable e) {
            }

View Full Code Here

    @Override
    public ZooKeeperWatcher getZooKeeperWatcher()
        throws ZooKeeperConnectionException {
      if (zooKeeper == null) {
        try {
          this.zooKeeper = new ZooKeeperWatcher(conf, "fconnection", this);
        } catch (ZooKeeperConnectionException zce) {
          throw zce;
        } catch (IOException e) {
          throw new ZooKeeperConnectionException("An error is preventing"
              + " Wasp from connecting to ZooKeeper", e);
View Full Code Here

    try {
      // Check ZK first.
      // If the connection exists, we may have a connection to ZK that does
      // not work anymore
      ZooKeeperWatcher zkw = null;
      try {
        zkw = connection.getZooKeeperWatcher();
        zkw.getRecoverableZooKeeper().getZooKeeper()
            .exists(zkw.baseZNode, false);

      } catch (IOException e) {
        throw new ZooKeeperConnectionException("Can't connect to ZooKeeper", e);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new ZooKeeperConnectionException("Can't connect to ZooKeeper", e);
      } catch (KeeperException e) {
        throw new ZooKeeperConnectionException("Can't connect to ZooKeeper", e);
      } finally {
        if (zkw != null) {
          zkw.close();
        }
      }

      // Check Master
      connection.isMasterRunning();
View Full Code Here

        this.isa.getPort(), System.currentTimeMillis());

    // set the thread name now we have an address
    setName(MASTER + "-" + this.serverName.toString());

    this.zooKeeper = new ZooKeeperWatcher(conf, MASTER + ":" + isa.getPort(),
        this, true);

    // metrics interval: using the same property as fserver.
    this.msgInterval = conf.getInt("wasp.fserver.msginterval", 3 * 1000);

 
View Full Code Here

      printOutEntityGroups(server, "Initial entityGroups: ");
      int entityGroupCount = server.getOnlineEntityGroups().size();
      // Insert into zk a blocking znode, a znode of same name as entityGroup
      // so it gets in way of our splitting.

      ZooKeeperWatcher zkw = WaspTestingUtility
          .getZooKeeperWatcher(TESTING_UTIL);
      ZKAssign.createNodeClosing(zkw, egi, new ServerName("any.old.server",
          1234, -1));
      // Now try splitting.... should fail. And each should successfully
      // rollback.
View Full Code Here

          // hijacked.
          EntityGroup entityGroup = super.openEntityGroup();

          // Don't actually open entityGroup BUT remove the znode as though it'd
          // been hijacked on us.
          ZooKeeperWatcher zkw = this.server.getZooKeeper();
          String node = ZKAssign.getNodeName(zkw, egi.getEncodedName());
          try {
            ZKUtil.deleteNodeFailSilent(zkw, node);
          } catch (KeeperException e) {
            throw new RuntimeException("Ugh failed delete of " + node, e);
View Full Code Here

            .getOnlineEntityGroups().contains(eg));
  }

  @Test(timeout = 36000)
  public void testEnableDisableAddColumnDeleteColumn() throws Exception {
    ZooKeeperWatcher zkw = WaspTestingUtility.getZooKeeperWatcher(TEST_UTIL);
    byte[] tableName = Bytes.toBytes("testMasterAdmin");
    TEST_UTIL.createTable(tableName);
    ZKTable zkTable = new ZKTable(zkw);
    while (!zkTable.isEnabledTable("testMasterAdmin")) {
      Thread.sleep(10);
View Full Code Here

      throws InterruptedException, ZooKeeperConnectionException, IOException,
      KeeperException {
    MiniWaspCluster cluster = TEST_UTIL.getWaspCluster();
    log("Waiting for active/ready master");
    cluster.waitForActiveAndReadyMaster();
    zkw = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
        "testOpenedEntityGroupHandler", null);

    // Create a table with entityGroups
    byte[] table = Bytes.toBytes(tableName);
    byte[] family = Bytes.toBytes("family");
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.zookeeper.ZooKeeperWatcher

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.