This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static <T> CompletableFuture<T> firstSuccessful( | |
List<CompletableFuture<T>> futures, Predicate<T> predicate) { | |
if (futures == null || futures.isEmpty()) { | |
throw new AsynchronousHelperException("No successful result found"); | |
} | |
CompletableFuture<T> success = new CompletableFuture<>(); | |
AtomicInteger ref = new AtomicInteger(futures.size()); | |
Consumer<T> consumer = | |
t -> { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorPath; | |
import akka.actor.typed.ActorRef; | |
import akka.actor.typed.ActorSystem; | |
import akka.actor.typed.Behavior; | |
import akka.actor.typed.Props; | |
import akka.actor.typed.SpawnProtocol; | |
import akka.actor.typed.javadsl.AskPattern; | |
import akka.actor.typed.javadsl.Behaviors; | |
import org.junit.Assert; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openjdk.jmh.annotations._ | |
import java.util.concurrent.TimeUnit | |
import scala.annotation.nowarn | |
object CollectFirstBenchmark { | |
final val OperationsPerInvocation = 1000 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem; | |
import akka.actor.typed.ActorRef; | |
import akka.actor.typed.Behavior; | |
import akka.actor.typed.javadsl.AbstractBehavior; | |
import akka.actor.typed.javadsl.ActorContext; | |
import akka.actor.typed.javadsl.Adapter; | |
import akka.actor.typed.javadsl.Behaviors; | |
import akka.actor.typed.javadsl.Receive; | |
import akka.actor.typed.javadsl.TimerScheduler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* license agreements; and to You under the Apache License, version 2.0: | |
* | |
* https://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* This file is part of the Apache Pekko project, which was derived from Akka. | |
*/ | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem; | |
import akka.actor.InternalActorRef; | |
import akka.actor.LocalActorRef; | |
import akka.actor.testkit.typed.javadsl.ActorTestKit; | |
import akka.actor.typed.ActorRef; | |
import akka.actor.typed.Props; | |
import akka.actor.typed.internal.adapter.ActorRefAdapter; | |
import akka.actor.typed.internal.adapter.PropsAdapter; | |
import akka.actor.typed.javadsl.Behaviors; |