use of com.alibaba.jstorm.callback.AsyncLoopThread in project jstorm by alibaba.
the class JStormMetricsReporter method init.
public void init() {
if (JStormMetrics.enabled) {
this.checkMetricMetaThread = new AsyncLoopThread(new CheckMetricMetaThread());
this.flushMetricThread = new AsyncLoopThread(new FlushMetricThread());
}
}
use of com.alibaba.jstorm.callback.AsyncLoopThread in project jstorm by alibaba.
the class NimbusServer method cleanup.
public void cleanup() {
if (data == null || data.getIsShutdown().getAndSet(true)) {
LOG.info("Notify to quit nimbus");
return;
}
LOG.info("Begin to shutdown nimbus");
AsyncLoopRunnable.getShutdown().set(true);
data.getScheduExec().shutdownNow();
for (AsyncLoopThread t : smartThreads) {
t.cleanup();
JStormUtils.sleepMs(10);
t.interrupt();
// try {
// t.join();
// } catch (InterruptedException e) {
// LOG.error("join thread", e);
// }
LOG.info("Successfully cleanup " + t.getThread().getName());
}
if (serviceHandler != null) {
serviceHandler.shutdown();
}
if (topologyAssign != null) {
topologyAssign.cleanup();
LOG.info("Successfully shutdown TopologyAssign thread");
}
if (follower != null) {
follower.clean();
LOG.info("Successfully shutdown follower thread");
}
if (data != null) {
data.cleanup();
LOG.info("Successfully shutdown NimbusData");
}
if (thriftServer != null) {
thriftServer.stop();
LOG.info("Successfully shutdown thrift server");
}
if (hs != null) {
hs.shutdown();
LOG.info("Successfully shutdown httpserver");
}
LOG.info("Successfully shutdown nimbus");
// make sure shutdown nimbus
JStormUtils.halt_process(0, "!!!Shutdown!!!");
}
use of com.alibaba.jstorm.callback.AsyncLoopThread in project jstorm by alibaba.
the class Task method execute.
public TaskShutdownDameon execute() throws Exception {
taskSendTargets = echoToSystemBolt();
// create thread to get tuple from zeroMQ,
// and pass the tuple to bolt/spout
taskTransfer = mkTaskSending(workerData);
RunnableCallback baseExecutor = prepareExecutor();
//set baseExecutors for update
setBaseExecutors((BaseExecutors) baseExecutor);
AsyncLoopThread executor_threads = new AsyncLoopThread(baseExecutor, false, Thread.MAX_PRIORITY, true);
taskReceiver = mkTaskReceiver();
List<AsyncLoopThread> allThreads = new ArrayList<AsyncLoopThread>();
allThreads.add(executor_threads);
LOG.info("Finished loading task " + componentId + ":" + taskId);
taskShutdownDameon = getShutdown(allThreads, baseExecutor);
return taskShutdownDameon;
}
use of com.alibaba.jstorm.callback.AsyncLoopThread in project jstorm by alibaba.
the class NimbusServer method initMetricRunnable.
private void initMetricRunnable() {
AsyncLoopThread thread = new AsyncLoopThread(ClusterMetricsRunnable.getInstance());
smartThreads.add(thread);
}
use of com.alibaba.jstorm.callback.AsyncLoopThread in project jstorm by alibaba.
the class SupervisorManger method shutdown.
@Override
public void shutdown() {
if (shutdown.getAndSet(true)) {
LOG.info("Supervisor has been shutdown before " + supervisorId);
return;
}
LOG.info("Shutting down supervisor " + supervisorId);
AsyncLoopRunnable.getShutdown().set(true);
for (AsyncLoopThread thread : threads) {
thread.cleanup();
JStormUtils.sleepMs(10);
thread.interrupt();
// try {
// thread.join();
// } catch (InterruptedException e) {
// LOG.error(e.getMessage(), e);
// }
LOG.info("Successfully shutdown thread:" + thread.getThread().getName());
}
eventManager.shutdown();
try {
stormClusterState.disconnect();
} catch (Exception e) {
LOG.error("Failed to shutdown ZK client", e);
}
if (httpserver != null) {
httpserver.shutdown();
}
// if (this.cgroupManager != null)
// try {
// this.cgroupManager.close();
// } catch (IOException e) {
// LOG.error("Fail to close cgroup", e);
// }
isFinishShutdown = true;
JStormUtils.halt_process(0, "!!!Shutdown!!!");
}
Aggregations