@Override public CompletableFuture<MetricQueryServiceGateway> retrieveService(String queryServicePath) { ActorSelection selection = actorSystem.actorSelection(queryServicePath); return FutureUtils.toJava(selection.resolveOne(FutureUtils.toFiniteDuration(lookupTimeout))).thenApply(AkkaQueryServiceGateway::new); } }
@Override public CompletableFuture<MetricQueryServiceGateway> retrieveService(String queryServicePath) { ActorSelection selection = actorSystem.actorSelection(queryServicePath); return FutureUtils.toJava(selection.resolveOne(FutureUtils.toFiniteDuration(lookupTimeout))).thenApply(AkkaQueryServiceGateway::new); } }
@Override public CompletableFuture<MetricQueryServiceGateway> retrieveService(String queryServicePath) { ActorSelection selection = actorSystem.actorSelection(queryServicePath); return FutureUtils.toJava(selection.resolveOne(FutureUtils.toFiniteDuration(lookupTimeout))).thenApply(AkkaQueryServiceGateway::new); } }
private void sendRegistrationRequests() { for (Map.Entry<String, Boolean> entry : notifierRegistrationStatus.entrySet()) { if (!entry.getValue()) { try { LOG.debug("{} registering with {}", getSelf().path().toString(), entry.getKey()); ActorRef notifier = Await.result( getContext().actorSelection(entry.getKey()).resolveOne(duration), duration); notifier.tell(new RegisterRoleChangeListener(), getSelf()); } catch (Exception e) { LOG.error("ERROR!! Unable to send registration request to notifier {}", entry.getKey()); } } } }
@SuppressWarnings("checkstyle:IllegalCatch") private void sendRegistrationRequests() { for (Map.Entry<String, Boolean> entry : notifierRegistrationStatus.entrySet()) { if (!entry.getValue()) { try { LOG.debug("{} registering with {}", getSelf().path().toString(), entry.getKey()); ActorRef notifier = Await.result( getContext().actorSelection(entry.getKey()).resolveOne(DURATION), DURATION); notifier.tell(new RegisterRoleChangeListener(), getSelf()); } catch (Exception e) { LOG.error("ERROR!! Unable to send registration request to notifier {}", entry.getKey()); } } } }
private static ShardBackendInfo createBackendInfo(final Object result, final String shardName, final Long cookie) { Preconditions.checkArgument(result instanceof PrimaryShardInfo); final PrimaryShardInfo info = (PrimaryShardInfo) result; LOG.debug("Creating backend information for {}", info); return new ShardBackendInfo(info.getPrimaryShardActor().resolveOne(DEAD_TIMEOUT).value().get().get(), toABIVersion(info.getPrimaryShardVersion()), shardName, UnsignedLong.fromLongBits(cookie), info.getLocalShardDataTree()); } }
public Future<ActorRef> getActorRefFuture(K key) { final int partitionNumber = retrievalService.getPartitionID(key); synchronized (cacheLock) { ActorRef result = cache.get(partitionNumber); if(result != null) { return Futures.successful(result); } } LOG.debug("Retrieve actor URL from retrieval service."); String actorURL = retrievalService.retrieveActorURL(key); if (actorURL == null) { return Futures.failed(new Exception("Could not retrieve actor.")); } else { ActorSelection selection = getContext().system().actorSelection(actorURL); LOG.debug("Resolve actor URL to ActorRef."); Future<ActorRef> actorRefFuture = selection.resolveOne(lookupTimeout); actorRefFuture.onSuccess(new OnSuccess<ActorRef>() { @Override public void onSuccess(ActorRef result) throws Throwable { synchronized (cacheLock) { cache.put(partitionNumber, result); } } }, executor); return actorRefFuture; } }
final Future<ActorRef> topologyRefFuture = actorSystem.actorSelection(pathCreator.build()).resolveOne(FiniteDuration.create(10L, TimeUnit.SECONDS)); topologyRefFuture.onComplete(new OnComplete<ActorRef>() { @Override final Future<ActorRef> nodeRefFuture = actorSystem.actorSelection(pathCreator.withSuffix(nodeId).build()).resolveOne(FiniteDuration.create(10L, TimeUnit.SECONDS)); nodeRefFuture.onComplete(new OnComplete<ActorRef>() { @Override