Search in sources :

Example 1 with RunnableWithNdc

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();
}
Also used : RunnableWithNdc(org.apache.tez.common.RunnableWithNdc) TezEvent(org.apache.tez.runtime.api.impl.TezEvent)

Aggregations

RunnableWithNdc (org.apache.tez.common.RunnableWithNdc)1 TezEvent (org.apache.tez.runtime.api.impl.TezEvent)1