- final OnComplete<Object> onComplete = new OnComplete<Object>() {
- @Override
- public void onComplete(final Throwable failure, final Object reply) throws Throwable {
- if(failure != null) {
- LOG.error("FindRouters failed", failure);
- sender.tell(new akka.actor.Status.Failure(failure), self);
- return;
- }
-
- final RpcRegistry.Messages.FindRoutersReply findReply =
- (RpcRegistry.Messages.FindRoutersReply)reply;
-
- final List<Pair<ActorRef, Long>> actorRefList = findReply.getRouterWithUpdateTime();
-
- if(actorRefList == null || actorRefList.isEmpty()) {
- final String message = String.format(
- "No remote implementation found for rpc %s", msg.getRpc());
- sender.tell(new akka.actor.Status.Failure(new RpcErrorsException(
- message, Arrays.asList(RpcResultBuilder.newError(ErrorType.RPC,
- "operation-not-supported", message)))), self);
- return;
- }
-
- finishInvokeRpc(actorRefList, msg, sender, self);
- }
- };
-
- future.onComplete(onComplete, getContext().dispatcher());
- }
-
- protected void finishInvokeRpc(final List<Pair<ActorRef, Long>> actorRefList,
- final InvokeRpc msg, final ActorRef sender, final ActorRef self) {