private LongConsumer monitorDelay(String executorName, long executionInterval, TimeUnit unit) { long intervalInMs = unit.toMillis(executionInterval); return delayInMs -> { if (delayInMs > intervalInMs) { executorDelayCounter.incrementAndGet(); if (excessiveExecutionHandler != null) { try { excessiveExecutionHandler.accept(delayInMs); } catch (Throwable t) { logger() .error( t, "Error with custom handler for excessive execution times for executor " + executorName + "."); } } else { logger() .error( "Delay is : " + delayInMs + ". Unable to execute all activities within " + intervalInMs + " milliseconds for " + executorName + "!"); } } }; }
@Override public boolean tryAdvance(LongConsumer action) { Objects.requireNonNull(action, "The action is null"); if (index >= 0 && index < end) { action.accept(tuple.get(index++)); return true; } return false; }
@Override public void forEachRemaining(LongConsumer action) { Objects.requireNonNull(action, "The action is null"); if (index >= 0 && end <= tuple.getSize()) { while (index < end) { action.accept(tuple.get(index++)); } } }
/** Specified operation is called with the value received from the {@link #getMillis()} */ default void await(LongConsumer operation) { operation.accept(getMillis()); }
@Property public void anyOld(LongConsumer consumer, long arg) { consumer.accept(arg); }