@Test public void testDoAsActiveServer() throws TException, IOException, ChronosException { final ChronosServer chronosServer = createChronosServer(new HostPort("127.0.0.1", 2187)); Thread thread = new Thread() { @Override public void run() { chronosServer.doAsActiveServer(); } }; thread.start(); TTransport transport = new TSocket("127.0.0.1", 2187); transport.open(); TProtocol protocol = new TBinaryProtocol(transport); ChronosService.Client client = new ChronosService.Client(protocol); client.getTimestamp(); transport.close(); chronosServer.stopThriftServer(); assert true; chronosServer.getFailoverWatcher().close(); }
@Override public void doAsActiveServer() { try { LOG.info("As active master, init timestamp from ZooKeeper"); chronosImplement.initTimestamp(); } catch (Exception e) { LOG.fatal("Exception to init timestamp from ZooKeeper, exit immediately"); System.exit(0); } chronosServerWatcher.setBeenActiveMaster(true); LOG.info("Start to accept thrift request"); startThriftServer(); }
ChronosServer extends FailoverServer { @Override public void doAsActiveServer() { try { LOG.info("As active master, init timestamp from ZooKeeper"); chronosImplement.initTimestamp(); } catch (Exception e) { LOG.fatal("Exception to init timestamp from ZooKeeper, exit immediately"); System.exit(0); } chronosServerWatcher.setBeenActiveMaster(true); LOG.info("Start to accept thrift request"); startThriftServer(); } }
ChronosServer extends FailoverServer { @Override public void doAsActiveServer() { try { LOG.info("As active master, init timestamp from ZooKeeper"); chronosImplement.initTimestamp(); } catch (Exception e) { LOG.fatal("Exception to init timestamp from ZooKeeper, exit immediately"); System.exit(0); } chronosServerWatcher.setBeenActiveMaster(true); LOG.info("Start to accept thrift request"); startThriftServer(); } ChronosServer(final ChronosServerWatcher chronosServerWatcher, Properties properties);  ChronosServer(final ChronosServerWatcher chronosServerWatcher);  ChronosServer(Properties properties); }
ChronosServer extends FailoverServer { @Override public void doAsActiveServer() { try { LOG.info("As active master, init timestamp from ZooKeeper"); chronosImplement.initTimestamp(); } catch (Exception e) { LOG.fatal("Exception to init timestamp from ZooKeeper, exit immediately"); System.exit(0); } chronosServerWatcher.setBeenActiveMaster(true); LOG.info("Start to accept thrift request"); startThriftServer(); } ChronosServer(final ChronosServerWatcher chronosServerWatcher, Properties properties);  ChronosServer(final ChronosServerWatcher chronosServerWatcher);  ChronosServer(Properties properties); @Override void doAsActiveServer(); void stopThriftServer(); void startThriftServer(); static void main(String[] args); }
ChronosServer extends FailoverServer { @Override public void doAsActiveServer() { try { LOG.info("As active master, init timestamp from ZooKeeper"); chronosImplement.initTimestamp(); } catch (Exception e) { LOG.fatal("Exception to init timestamp from ZooKeeper, exit immediately"); System.exit(0); } chronosServerWatcher.setBeenActiveMaster(true); LOG.info("Start to accept thrift request"); startThriftServer(); } ChronosServer(final ChronosServerWatcher chronosServerWatcher, Properties properties);  ChronosServer(final ChronosServerWatcher chronosServerWatcher);  ChronosServer(Properties properties); @Override void doAsActiveServer(); void stopThriftServer(); void startThriftServer(); static void main(String[] args); static final String CLUSTER_NAME; static final String MAX_THREAD; static final String ZK_ADVANCE_TIMESTAMP; }