예제 #1
0
 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
                     + "!");
       }
     }
   };
 }
예제 #2
0
 @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;
 }
예제 #3
0
 @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++));
     }
   }
 }
예제 #4
0
 /** Specified operation is called with the value received from the {@link #getMillis()} */
 default void await(LongConsumer operation) {
   operation.accept(getMillis());
 }
 @Property
 public void chained(LongConsumer first, LongConsumer second, long arg) {
   first.andThen(second).accept(arg);
 }
 @Property
 public void anyOld(LongConsumer consumer, long arg) {
   consumer.accept(arg);
 }