- private ListenableFuture<RpcResult<CompositeNode>> executeMsg(Object rpcMsg) {
- CompositeNode result = null;
- Collection<RpcError> errors = errors = new ArrayList<>();
- try {
- Object response = ActorUtil.executeLocalOperation(rpcBroker, rpcMsg, ActorUtil.ASK_DURATION, ActorUtil.AWAIT_DURATION);
- if(response instanceof RpcResponse) {
- RpcResponse rpcResponse = (RpcResponse) response;
- result = XmlUtils.xmlToCompositeNode(rpcResponse.getResultCompositeNode());
- } else if(response instanceof ErrorResponse) {
- ErrorResponse errorResponse = (ErrorResponse) response;
- Exception e = errorResponse.getException();
- errors.add(RpcErrors.getRpcError(null, null, null, null, e.getMessage(), null, e.getCause()));
- }
- } catch (Exception e) {
- LOG.error("Error occurred while invoking RPC actor {}", e.toString());
- errors.add(RpcErrors.getRpcError(null, null, null, null, e.getMessage(), null, e.getCause()));
+ future.onComplete(onComplete, ExecutionContext.Implicits$.MODULE$.global());
+ // FIXME find non blocking way for implementation
+ try {
+ return Futures.immediateCheckedFuture(listenableFuture.get());
+ }
+ catch (InterruptedException | ExecutionException e) {
+ LOG.debug("Unexpected remote RPC exception.", e);
+ return Futures.immediateFailedCheckedFuture((DOMRpcException) new DOMRpcImplementationNotAvailableException(e, "Unexpected remote RPC exception"));
+ }