use of org.apache.storm.executor.ExecutorShutdown in project storm by apache.
the class Worker method shutdown.
@Override
public void shutdown() {
try {
LOG.info("Shutting down worker {} {} {}", topologyId, assignmentId, port);
if (workerState != null) {
for (IConnection socket : workerState.cachedNodeToPortSocket.get().values()) {
// this will do best effort flushing since the linger period
// was set on creation
socket.close();
}
LOG.info("Terminating messaging context");
LOG.info("Shutting down executors");
for (IRunningExecutor executor : executorsAtom.get()) {
((ExecutorShutdown) executor).shutdown();
}
LOG.info("Shut down executors");
LOG.info("Shutting down transfer thread");
workerState.haltWorkerTransfer();
if (transferThread != null) {
transferThread.interrupt();
transferThread.join();
LOG.info("Shut down transfer thread");
}
workerState.heartbeatTimer.close();
workerState.refreshConnectionsTimer.close();
workerState.refreshCredentialsTimer.close();
workerState.checkForUpdatedBlobsTimer.close();
workerState.refreshActiveTimer.close();
workerState.executorHeartbeatTimer.close();
workerState.userTimer.close();
workerState.refreshLoadTimer.close();
workerState.resetLogLevelsTimer.close();
workerState.flushTupleTimer.close();
workerState.backPressureCheckTimer.close();
// this is fine because the only time this is shared is when it's a local context,
// in which case it's a noop
workerState.mqContext.term();
workerState.closeResources();
LOG.info("Trigger any worker shutdown hooks");
workerState.runWorkerShutdownHooks();
workerState.stormClusterState.removeWorkerHeartbeat(topologyId, assignmentId, (long) port);
LOG.info("Disconnecting from storm cluster state context");
workerState.stormClusterState.disconnect();
workerState.stateStorage.close();
} else {
LOG.error("workerState is null");
}
metricRegistry.stop();
SharedMetricRegistries.remove(WORKER_METRICS_REGISTRY);
LOG.info("Shut down worker {} {} {}", topologyId, assignmentId, port);
} catch (Exception ex) {
throw Utils.wrapInRuntime(ex);
}
}
Aggregations