use of com.alibaba.jstorm.callback.RunnableCallback in project jstorm by alibaba.
the class Worker method startDispatchThread.
private AsyncLoopThread startDispatchThread() {
// send tuple directly from netty server
// send control tuple to dispatch thread
// startDispatchDisruptor();
IContext context = workerData.getContext();
String topologyId = workerData.getTopologyId();
//create recv connection
Map stormConf = workerData.getStormConf();
long timeout = JStormUtils.parseLong(stormConf.get(Config.TOPOLOGY_DISRUPTOR_WAIT_TIMEOUT), 10);
WaitStrategy waitStrategy = new TimeoutBlockingWaitStrategy(timeout, TimeUnit.MILLISECONDS);
int queueSize = JStormUtils.parseInt(stormConf.get(Config.TOPOLOGY_CTRL_BUFFER_SIZE), 256);
DisruptorQueue recvControlQueue = DisruptorQueue.mkInstance("Dispatch-control", ProducerType.MULTI, queueSize, waitStrategy, false, 0, 0);
//metric for recvControlQueue
QueueGauge revCtrlGauge = new QueueGauge(recvControlQueue, MetricDef.RECV_CTRL_QUEUE);
JStormMetrics.registerWorkerMetric(JStormMetrics.workerMetricName(MetricDef.RECV_CTRL_QUEUE, MetricType.GAUGE), new AsmGauge(revCtrlGauge));
IConnection recvConnection = context.bind(topologyId, workerData.getPort(), workerData.getDeserializeQueues(), recvControlQueue, false, workerData.getTaskids());
workerData.setRecvConnection(recvConnection);
// create recvice control messages's thread
RunnableCallback recvControlDispather = new VirtualPortCtrlDispatch(workerData, recvConnection, recvControlQueue, MetricDef.RECV_THREAD);
return new AsyncLoopThread(recvControlDispather, false, Thread.MAX_PRIORITY, true);
}
use of com.alibaba.jstorm.callback.RunnableCallback in project jstorm by alibaba.
the class EventManagerImp method run.
@Override
public void run() {
try {
RunnableCallback r = queue.take();
if (r == null) {
return;
}
r.run();
e = r.error();
proccessinc();
} catch (InterruptedException e) {
LOG.info("InterruptedException when processing event ");
}
}
Aggregations