Search in sources :

Example 6 with IntConsumer

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);
}
Also used : IntConsumer(java.util.function.IntConsumer)

Example 7 with IntConsumer

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));
}
Also used : Spliterator(java.util.Spliterator) IntConsumer(java.util.function.IntConsumer) ObjIntConsumer(java.util.function.ObjIntConsumer)

Aggregations

IntConsumer (java.util.function.IntConsumer)7 Spliterator (java.util.Spliterator)2 ObjIntConsumer (java.util.function.ObjIntConsumer)2 TestCase (junit.framework.TestCase)2 AudioLoadResultHandler (com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler)1 YoutubeAudioSourceManager (com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioSourceManager)1 FriendlyException (com.sedmelluq.discord.lavaplayer.tools.FriendlyException)1 AudioPlaylist (com.sedmelluq.discord.lavaplayer.track.AudioPlaylist)1 AudioTrack (com.sedmelluq.discord.lavaplayer.track.AudioTrack)1 AudioTrackInfo (com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo)1 Color (java.awt.Color)1 Optional (java.util.Optional)1 TimeUnit (java.util.concurrent.TimeUnit)1 Slf4j (lombok.extern.slf4j.Slf4j)1 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)1 Permission (net.dv8tion.jda.core.Permission)1 GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)1 ReactionOperations (net.kodehawa.mantarobot.core.listeners.operations.ReactionOperations)1 MantaroData (net.kodehawa.mantarobot.data.MantaroData)1 DBGuild (net.kodehawa.mantarobot.data.entities.DBGuild)1