use of org.apache.tez.common.RunnableWithNdc in project tez by apache.
the class LogicalIOProcessorRuntimeTask method startRouterThread.
private void startRouterThread() {
eventRouterThread = new Thread(new RunnableWithNdc() {
public void runInternal() {
while (!isTaskDone() && !Thread.currentThread().isInterrupted()) {
try {
TezEvent e = eventsToBeProcessed.take();
if (e == null) {
continue;
}
if (!handleEvent(e)) {
LOG.warn("Stopping Event Router thread as failed to handle" + " event: " + e);
return;
}
} catch (InterruptedException e) {
if (!isTaskDone()) {
LOG.warn("Event Router thread interrupted. Returning.");
}
Thread.currentThread().interrupt();
return;
}
}
}
});
eventRouterThread.setName("TezTaskEventRouter{" + taskSpec.getTaskAttemptID().toString() + "}");
eventRouterThread.start();
}
Aggregations