@Override protected void shutDown() throws Exception { reactor.stopAsync().awaitTerminated(); zooKeeperRegistrar.shutDown(); }
@Override protected void startUp() throws Exception { zooKeeperRegistrar.startUp(); client.getConnectionStateListenable().addListener(listener); reactor.startAsync().awaitRunning(); reactor.signal(); }
successfullyRegistered = zooKeeperRegistrar.tryToRegister(client); } catch (Exception e) { if (e instanceof ConnectionLossException) {
@Override protected void shutDown() throws Exception { server.stop(); server.join(); registrar.close(); rollingUpdateService.stopAsync().awaitTerminated(); expiredJobReaper.stopAsync().awaitTerminated(); zkRegistrar.stopAsync().awaitTerminated(); zooKeeperClient.close(); }
@Override protected void startUp() throws Exception { logBanner(); zkRegistrar.startAsync().awaitRunning(); model.startAsync().awaitRunning(); agent.startAsync().awaitRunning(); hostInfoReporter.startAsync(); agentInfoReporter.startAsync(); environmentVariableReporter.startAsync(); labelReporter.startAsync(); metrics.start(); if (server != null) { try { server.start(); } catch (Exception e) { log.error("Unable to start server, shutting down", e); server.stop(); } } }
/** * Create a Zookeeper client and create the control and state nodes if needed. * * @param config The service configuration. * @return A zookeeper client. */ private ZooKeeperClient setupZookeeperClient(final MasterConfig config) { final RetryPolicy zooKeeperRetryPolicy = new ExponentialBackoffRetry(1000, 3); final CuratorFramework curator = curatorClientFactory.newClient( config.getZooKeeperConnectionString(), config.getZooKeeperSessionTimeoutMillis(), config.getZooKeeperConnectionTimeoutMillis(), zooKeeperRetryPolicy, config.getZooKeeperNamespace()); final ZooKeeperClient client = new DefaultZooKeeperClient(curator, config.getZooKeeperClusterId()); client.start(); zkRegistrar = new ZooKeeperRegistrar(client, new MasterZooKeeperRegistrar(config.getName())); return client; } }
private boolean isAlive() { return state().ordinal() < STOPPING.ordinal(); } }
@Override protected void shutDown() throws Exception { if (server != null) { server.stop(); } hostInfoReporter.stopAsync().awaitTerminated(); agentInfoReporter.stopAsync().awaitTerminated(); environmentVariableReporter.stopAsync().awaitTerminated(); labelReporter.stopAsync().awaitTerminated(); agent.stopAsync().awaitTerminated(); if (serviceRegistrar != null) { serviceRegistrar.close(); } zkRegistrar.stopAsync().awaitTerminated(); model.stopAsync().awaitTerminated(); metrics.stop(); zooKeeperClient.close(); try { stateLock.release(); } catch (IOException e) { log.error("Failed to release state lock", e); } try { stateLockFile.close(); } catch (IOException e) { log.error("Failed to close state lock file", e); } }
@Override protected void startUp() throws Exception { logBanner(); if (!config.getNoZooKeeperMasterRegistration()) { zkRegistrar.startAsync().awaitRunning(); } expiredJobReaper.startAsync().awaitRunning(); rollingUpdateService.startAsync().awaitRunning(); try { server.start(); } catch (Exception e) { log.error("Unable to start server, shutting down", e); server.stop(); } final ServiceRegistration serviceRegistration = ServiceRegistration.newBuilder() .endpoint("helios", "http", config.getHttpEndpoint().getPort(), config.getDomain(), config.getName()) .build(); registrar.register(serviceRegistration); }
/** * Create a Zookeeper client and create the control and state nodes if needed. * * @param config The service configuration. * @return A zookeeper client. */ private ZooKeeperClient setupZookeeperClient(final AgentConfig config, final String id) { final RetryPolicy zooKeeperRetryPolicy = new ExponentialBackoffRetry(1000, 3); final CuratorFramework curator = new CuratorClientFactoryImpl().newClient( config.getZooKeeperConnectionString(), config.getZooKeeperSessionTimeoutMillis(), config.getZooKeeperConnectionTimeoutMillis(), zooKeeperRetryPolicy, config.getZooKeeperNamespace()); final ZooKeeperClient client = new DefaultZooKeeperClient(curator, config.getZooKeeperClusterId()); client.start(); // Register the agent zkRegistrar = new ZooKeeperRegistrar(client, new AgentZooKeeperRegistrar(this, config.getName(), id)); return client; }