Source:
public void run() { try { this.processor.prepare(this.streamConfig); if(this.counter == null) { this.counter = new StreamsTaskCounter(this.processor.getClass().getName()+ UUID.randomUUID().toString()); } while(this.keepRunning.get()) { StreamsDatum datum = null; try { this.blocked.set(true); datum = this.inQueue.poll(5, TimeUnit.SECONDS); this.blocked.set(false); } catch (InterruptedException ie) { LOGGER.warn("Received InteruptedException, shutting down and re-applying interrupt status."); this.keepRunning.set(false); Thread.currentThread().interrupt(); } if(datum != null) { this.counter.incrementReceivedCount(); try { long startTime = System.currentTimeMillis(); List<StreamsDatum> output = this.processor.process(datum); this.counter.addTime(System.currentTimeMillis() - startTime); if(output != null) { for(StreamsDatum outDatum : output) { super.addToOutgoingQueue(datum); this.counter.incrementEmittedCount(); statusCounter.incrementStatus(DatumStatus.SUCCESS); } } } catch (InterruptedException ie) { LOGGER.warn("Received InteruptedException, shutting down and re-applying interrupt status."); this.keepRunning.set(false); Thread.currentThread().interrupt(); } catch (Throwable t) { this.counter.incrementErrorCount(); LOGGER.warn("Caught Throwable in processor, : {}", this.processor.getClass().getName(), t.getMessage()); statusCounter.incrementStatus(DatumStatus.FAIL); DatumUtils.addErrorToMetadata(datum, t, this.processor.getClass()); } } else { LOGGER.debug("Removed NULL datum from queue at processor : {}", this.processor.getClass().getName()); } } } finally { this.isRunning.set(false); this.processor.cleanUp(); } }

Target:
public void run() { try { this.processor.prepare(this.streamConfig); if(this.counter == null) { this.counter = new StreamsTaskCounter(this.processor.getClass().getName()+ UUID.randomUUID().toString()); } while(this.keepRunning.get()) { StreamsDatum datum = null; try { this.blocked.set(true); datum = this.inQueue.poll(5, TimeUnit.SECONDS); this.blocked.set(false); } catch (InterruptedException ie) { LOGGER.warn("Received InteruptedException, shutting down and re-applying interrupt status."); this.keepRunning.set(false); Thread.currentThread().interrupt(); } if(datum != null) { this.counter.incrementReceivedCount(); try { long startTime = System.currentTimeMillis(); List<StreamsDatum> output = this.processor.process(datum); this.counter.addTime(System.currentTimeMillis() - startTime); if(output != null) { for(StreamsDatum outDatum : output) { super.addToOutgoingQueue(outDatum); this.counter.incrementEmittedCount(); statusCounter.incrementStatus(DatumStatus.SUCCESS); } } } catch (InterruptedException ie) { LOGGER.warn("Received InteruptedException, shutting down and re-applying interrupt status."); this.keepRunning.set(false); Thread.currentThread().interrupt(); } catch (Throwable t) { this.counter.incrementErrorCount(); LOGGER.warn("Caught Throwable in processor, : {}", this.processor.getClass().getName(), t.getMessage()); statusCounter.incrementStatus(DatumStatus.FAIL); DatumUtils.addErrorToMetadata(datum, t, this.processor.getClass()); } } else { LOGGER.debug("Removed NULL datum from queue at processor : {}", this.processor.getClass().getName()); } } } finally { this.isRunning.set(false); this.processor.cleanUp(); } }