+ }, actorContext.getClientDispatcher());
+ }
+
+ @Override
+ List<Future<ActorSelection>> getCohortFutures() {
+ List<Future<ActorSelection>> cohortFutures = new ArrayList<>(cohorts.size());
+ for(CohortInfo info: cohorts) {
+ cohortFutures.add(info.getActorFuture());
+ }
+
+ return cohortFutures;
+ }
+
+ static class CohortInfo {
+ private final Future<ActorSelection> actorFuture;
+ private volatile ActorSelection resolvedActor;
+ private final Supplier<Short> actorVersionSupplier;
+
+ CohortInfo(Future<ActorSelection> actorFuture, Supplier<Short> actorVersionSupplier) {
+ this.actorFuture = actorFuture;
+ this.actorVersionSupplier = actorVersionSupplier;
+ }
+
+ Future<ActorSelection> getActorFuture() {
+ return actorFuture;
+ }
+
+ ActorSelection getResolvedActor() {
+ return resolvedActor;
+ }
+
+ void setResolvedActor(ActorSelection resolvedActor) {
+ this.resolvedActor = resolvedActor;
+ }
+
+ short getActorVersion() {
+ Preconditions.checkState(resolvedActor != null,
+ "getActorVersion cannot be called until the actor is resolved");
+ return actorVersionSupplier.get();
+ }