Examples of ChronosServerWatcher


Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

    TEST_UTIL.shutdownMiniZKCluster();
  }

  @Before
  public void resetZooKeeper() throws IOException, KeeperException {
    ChronosServerWatcher chronosWatcher = createChronosWatcher(new HostPort("127.0.0.1", 10086));
    ZooKeeperUtil.deleteNodeRecursively(chronosWatcher, chronosWatcher.getBaseZnode());
    chronosWatcher.close();
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

    properties.setProperty(FailoverServer.ZK_QUORUM,
      ZKConfig.getZKQuorumServersString(TEST_UTIL.getConfiguration()));
    properties.setProperty(FailoverServer.SESSION_TIMEOUT, String.valueOf(3000));
    properties.setProperty(FailoverServer.CONNECT_RETRY_TIMES, String.valueOf(10));

    return new ChronosServerWatcher(properties);
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

    return new ChronosServerWatcher(properties);
  }

  @Test
  public void testInitZnode() throws IOException, KeeperException {
    ChronosServerWatcher chronosServerWatcher = createChronosWatcher(new HostPort("127.0.0.1",
        10086));

    assertTrue(ZooKeeperUtil.watchAndCheckExists(chronosServerWatcher,
      chronosServerWatcher.getBaseZnode()));
    assertTrue(ZooKeeperUtil.watchAndCheckExists(chronosServerWatcher,
      chronosServerWatcher.getBackupServersZnode()));
    assertTrue(ZooKeeperUtil.watchAndCheckExists(chronosServerWatcher,
      chronosServerWatcher.getPersistentTimestampZnode()));

    chronosServerWatcher.close();
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

  }

  @Test
  public void testSetPersistentTimestamp() throws IOException, FatalChronosException,
      ChronosException, KeeperException {
    ChronosServerWatcher chronosServerWatcher = createChronosWatcher(new HostPort("127.0.0.1",
        10086));

    long expectTimestamp = RandomUtils.nextLong();
    chronosServerWatcher.setPersistentTimestamp(expectTimestamp);
    long actualTimestamp = ZooKeeperUtil.bytesToLong(ZooKeeperUtil.getDataAndWatch(
      chronosServerWatcher, chronosServerWatcher.getPersistentTimestampZnode()));
    assertTrue(actualTimestamp == expectTimestamp);

    chronosServerWatcher.close();
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

    chronosServerWatcher.close();
  }

  @Test
  public void testGetPersistentTimestamp() throws IOException, ChronosException, KeeperException {
    ChronosServerWatcher chronosServerWatcher = createChronosWatcher(new HostPort("127.0.0.1",
        10086));

    assertTrue(chronosServerWatcher.getPersistentTimestamp() == 0);

    long expectTimestamp = RandomUtils.nextLong();
    chronosServerWatcher.setPersistentTimestamp(expectTimestamp);
    assertTrue(chronosServerWatcher.getPersistentTimestamp() == expectTimestamp);

    chronosServerWatcher.close();
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

    properties.setProperty(FailoverServer.SESSION_TIMEOUT, String.valueOf(3000));
    properties.setProperty(ChronosServer.MAX_THREAD, "100000");
    properties.setProperty(ChronosServer.ZK_ADVANCE_TIMESTAMP, "100000");
    properties.setProperty(FailoverServer.CONNECT_RETRY_TIMES, String.valueOf(10));

    return new ChronosServer(new ChronosServerWatcher(properties));
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

      ZKConfig.getZKQuorumServersString(TEST_UTIL.getConfiguration()));
    properties.setProperty(FailoverServer.SESSION_TIMEOUT, String.valueOf(3000));
    properties.setProperty(ChronosServer.ZK_ADVANCE_TIMESTAMP, "100000");
    properties.setProperty(FailoverServer.CONNECT_RETRY_TIMES, String.valueOf(10));

    return new ChronosImplement(properties, new ChronosServerWatcher(properties));
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

    properties.setProperty(ChronosServer.SESSION_TIMEOUT, String.valueOf(3000));
    properties.setProperty(ChronosServer.MAX_THREAD, "100000");
    properties.setProperty(ChronosServer.ZK_ADVANCE_TIMESTAMP, "100000");
    properties.setProperty(ChronosServer.CONNECT_RETRY_TIMES, String.valueOf(10));

    return new ChronosServer(new ChronosServerWatcher(properties));
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.ChronosServerWatcher

    properties.setProperty(FailoverServer.SESSION_TIMEOUT, String.valueOf(3000));
    properties.setProperty(ChronosServer.MAX_THREAD, "100000");
    properties.setProperty(ChronosServer.ZK_ADVANCE_TIMESTAMP, "100000");
    properties.setProperty(FailoverServer.CONNECT_RETRY_TIMES, String.valueOf(10));

    return new ChronosServer(new ChronosServerWatcher(properties));
  }
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.