Examples of ChronosClient


Examples of com.xiaomi.infra.chronos.client.ChronosClient

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

    return new ChronosClient(new ChronosClientWatcher(properties));
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.client.ChronosClient

      }
    };
    thread.start();

    Thread.sleep(500); // wait for server to start
    ChronosClient chronosClient = createChronosServer();
    long timestamp1 = chronosClient.getTimestamp();
    long timestamp2 = chronosClient.getTimestamp();
    assertTrue(timestamp1 < timestamp2);
   
    chronosServer.stopThriftServer();
    chronosServer.getFailoverWatcher().close();
    chronosClient.getChronosClientWatcher().close();
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.client.ChronosClient

      }
    };
    thread.start();

    Thread.sleep(500); // wait for server to start
    ChronosClient chronosClient = createChronosServer();
    long timestamp1 = chronosClient.getTimestamps(100);
    long timestamp2 = chronosClient.getTimestamps(100);
    assertTrue(timestamp2 - timestamp1 >= 100);

    chronosServer.stopThriftServer();
    chronosServer.getFailoverWatcher().close();
    chronosClient.getChronosClientWatcher().close();
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.client.ChronosClient

    if (argv.length != 2) {
      System.err.println("Wrong parameters, exit immediately");
      return;
    }
   
    ChronosClient chronosClient = null;
    try {
      chronosClient = new ChronosClient(argv[0], argv[1]);
      System.out.println("Get timestamp " + chronosClient.getTimestamp());
    } catch (IOException e) {
      System.err.println("Error to connect with ZooKeeper or ChronosServer, check the configuration");
    } finally {
      chronosClient.close();
    }
  }
View Full Code Here

Examples of com.xiaomi.infra.chronos.client.ChronosClient

   *
   * @param zkQuorum the ZooKeeper quorum string for ChronosClientWatcher
   * @throws IOException when error to construct ChronosClientWatcher
   */
  public BenchmarkChronosServer(String zkQuorum, String clusterName) throws IOException {
    chronosClient = new ChronosClient(zkQuorum, clusterName);
  }
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.