Source:
public void readTuplesAndExecute(Communicator<Message> inQueue) { TopologyContextImpl topologyContext = helper.getTopologyContext(); Duration instanceExecuteBatchTime = systemConfig.getInstanceExecuteBatchTime(); long startOfCycle = System.nanoTime(); while (!inQueue.isEmpty()) { Message msg = inQueue.poll(); if (msg instanceof CheckpointManager.InitiateStatefulCheckpoint) { String checkpointId = ((CheckpointManager.InitiateStatefulCheckpoint) msg).getCheckpointId(); LOG.info("Persisting state for checkpoint: " + checkpointId); persistState(checkpointId); } if (msg instanceof HeronTuples.HeronTupleSet) { HeronTuples.HeronTupleSet tuples = (HeronTuples.HeronTupleSet) msg; if (tuples.hasControl()) { throw new RuntimeException("Bolt cannot get acks/fails from other components"); } TopologyAPI.StreamId stream = tuples.getData().getStream(); int nValues = topologyContext.getComponentOutputFields( stream.getComponentName(), stream.getId()).size(); int sourceTaskId = tuples.getSrcTaskId(); for (HeronTuples.HeronDataTuple dataTuple : tuples.getData().getTuplesList()) { long startExecuteTuple = System.nanoTime(); List<Object> values = new ArrayList<>(nValues); for (int i = 0; i < nValues; i++) { values.add(serializer.deserialize(dataTuple.getValues(i).toByteArray())); } TupleImpl t = new TupleImpl(topologyContext, stream, dataTuple.getKey(), dataTuple.getRootsList(), values, startExecuteTuple, false, sourceTaskId); bolt.execute(t); long endExecuteTuple = System.nanoTime(); long executeLatency = endExecuteTuple - startExecuteTuple; topologyContext.invokeHookBoltExecute(t, Duration.ofNanos(executeLatency)); boltMetrics.executeTuple(stream.getId(), stream.getComponentName(), executeLatency); } long currentTime = System.nanoTime(); if (currentTime - startOfCycle - instanceExecuteBatchTime.toNanos() > 0) { break; } } } }

Target:
public void readTuplesAndExecute(Communicator<Message> inQueue) { TopologyContextImpl topologyContext = helper.getTopologyContext(); Duration instanceExecuteBatchTime = systemConfig.getInstanceExecuteBatchTime(); long startOfCycle = System.nanoTime(); while (!inQueue.isEmpty()) { Message msg = inQueue.poll(); if (msg instanceof CheckpointManager.InitiateStatefulCheckpoint) { String checkpointId = ((CheckpointManager.InitiateStatefulCheckpoint) msg).getCheckpointId(); persistState(checkpointId); } if (msg instanceof HeronTuples.HeronTupleSet) { HeronTuples.HeronTupleSet tuples = (HeronTuples.HeronTupleSet) msg; if (tuples.hasControl()) { throw new RuntimeException("Bolt cannot get acks/fails from other components"); } TopologyAPI.StreamId stream = tuples.getData().getStream(); int nValues = topologyContext.getComponentOutputFields( stream.getComponentName(), stream.getId()).size(); int sourceTaskId = tuples.getSrcTaskId(); for (HeronTuples.HeronDataTuple dataTuple : tuples.getData().getTuplesList()) { long startExecuteTuple = System.nanoTime(); List<Object> values = new ArrayList<>(nValues); for (int i = 0; i < nValues; i++) { values.add(serializer.deserialize(dataTuple.getValues(i).toByteArray())); } TupleImpl t = new TupleImpl(topologyContext, stream, dataTuple.getKey(), dataTuple.getRootsList(), values, startExecuteTuple, false, sourceTaskId); bolt.execute(t); long endExecuteTuple = System.nanoTime(); long executeLatency = endExecuteTuple - startExecuteTuple; topologyContext.invokeHookBoltExecute(t, Duration.ofNanos(executeLatency)); boltMetrics.executeTuple(stream.getId(), stream.getComponentName(), executeLatency); } long currentTime = System.nanoTime(); if (currentTime - startOfCycle - instanceExecuteBatchTime.toNanos() > 0) { break; } } } }