- private static DOMRpcException mapException(final ExecutionException ex) {
- final Throwable cause = ex.getCause();
- if (cause instanceof DOMRpcException) {
- return (DOMRpcException) cause;
- }
- return new RemoteDOMRpcException("Exception during invoking RPC", ex);
- }
-
- private final class FutureUpdater extends OnComplete<Object> {
-
- @Override
- public void onComplete(final Throwable error, final Object reply) {
- if (error != null) {
- RemoteDOMRpcFuture.this.failNow(error);
- } else if (reply instanceof RpcResponse) {
- final RpcResponse rpcReply = (RpcResponse) reply;
- final NormalizedNode<?, ?> result = rpcReply.getResultNormalizedNode();
-
- LOG.debug("Received response for rpc {}: result is {}", rpcName, result);
-
- RemoteDOMRpcFuture.this.set(new DefaultDOMRpcResult(result));
-
- LOG.debug("Future {} for rpc {} successfully completed", RemoteDOMRpcFuture.this, rpcName);
- } else {
- RemoteDOMRpcFuture.this.failNow(new IllegalStateException("Incorrect reply type " + reply
- + "from Akka"));
- }
- }
+ @Override
+ DOMRpcException wrapCause(final Throwable cause) {
+ return new RemoteDOMRpcException("Exception during invoking RPC", cause);