use of java.util.function.IntConsumer in project CorfuDB by CorfuDB.
the class AbstractCorfuTest method scheduleThreaded.
/**
* This engine takes the testSM state machine (same as scheduleInterleaved above),
* and executes state machines in separate threads running concurrenty.
* There is no explicit interleaving control here.
*
* @param numThreads specifies desired concurrency level
* @param numTasks specifies the desired number of state machine instances
*/
public void scheduleThreaded(int numThreads, int numTasks) throws Exception {
scheduleConcurrently(numTasks, (numTask) -> {
for (IntConsumer step : testSM) step.accept(numTask);
});
executeScheduled(numThreads, PARAMETERS.TIMEOUT_NORMAL);
}
use of java.util.function.IntConsumer in project jdk8u_jdk by JetBrains.
the class IntPipeline method forEachWithCancel.
@Override
final void forEachWithCancel(Spliterator<Integer> spliterator, Sink<Integer> sink) {
Spliterator.OfInt spl = adapt(spliterator);
IntConsumer adaptedSink = adapt(sink);
do {
} while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
}
Aggregations