((FutureAdapter) future).getFuture().setCallback(new FinishSpanCallback(span));
@Override public boolean isDone() { return future.isDone(); }
@SuppressWarnings("unchecked") public V get() throws InterruptedException, ExecutionException { try { return (V) (((Result) future.get()).recreate()); } catch (RemotingException e) { throw new ExecutionException(e.getMessage(), e); } catch (Throwable e) { throw new RpcException(e); } }
@Override @SuppressWarnings("unchecked") public V get() throws InterruptedException, ExecutionException { try { return (V) (((Result) future.get()).recreate()); } catch (RemotingException e) { throw new ExecutionException(e.getMessage(), e); } catch (Throwable e) { throw new RpcException(e); } }
@SuppressWarnings("unchecked") public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { int timeoutInMillis = (int) unit.convert(timeout, TimeUnit.MILLISECONDS); try { return (V) (((Result) future.get(timeoutInMillis)).recreate()); } catch (com.alibaba.dubbo.remoting.TimeoutException e) { throw new TimeoutException(StringUtils.toString(e)); } catch (RemotingException e) { throw new ExecutionException(e.getMessage(), e); } catch (Throwable e) { throw new JahhanException(e); } }
private void asyncCallback(final Invoker<?> invoker, final Invocation invocation) { Future<?> f = RpcContext.getContext().getFuture(); if (f instanceof FutureAdapter) { ResponseFuture future = ((FutureAdapter<?>) f).getFuture(); future.setCallback(new ResponseCallback() { @Override public void done(Object rpcResult) { if (rpcResult == null) { logger.error(new IllegalStateException("invalid result value : null, expected " + Result.class.getName())); return; } ///must be rpcResult if (!(rpcResult instanceof Result)) { logger.error(new IllegalStateException("invalid result type :" + rpcResult.getClass() + ", expected " + Result.class.getName())); return; } Result result = (Result) rpcResult; if (result.hasException()) { fireThrowCallback(invoker, invocation, result.getException()); } else { fireReturnCallback(invoker, invocation, result.getValue()); } } @Override public void caught(Throwable exception) { fireThrowCallback(invoker, invocation, exception); } }); } }
public boolean isDone() { return future.isDone(); }
@SuppressWarnings("unchecked") public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { int timeoutInMillis = (int) unit.convert(timeout, TimeUnit.MILLISECONDS); try { return (V) (((Result) future.get(timeoutInMillis)).recreate()); } catch (com.alibaba.dubbo.remoting.TimeoutException e) { throw new TimeoutException(StringUtils.toString(e)); } catch (RemotingException e) { throw new ExecutionException(e.getMessage(), e); } catch (Throwable e) { throw new RpcException(e); } }
private void asyncCallback(final Invoker<?> invoker, final Invocation invocation) { Future<?> f = RpcContext.getContext().getFuture(); if (f instanceof FutureAdapter) { ResponseFuture future = ((FutureAdapter<?>)f).getFuture(); future.setCallback(new ResponseCallback() { public void done(Object rpcResult) { if (rpcResult == null){ logger.error(new IllegalStateException("invalid result value : null, expected "+Result.class.getName())); return; } ///must be rpcResult if (! (rpcResult instanceof Result)){ logger.error(new IllegalStateException("invalid result type :" + rpcResult.getClass() + ", expected "+Result.class.getName())); return; } Result result = (Result) rpcResult; if (result.hasException()) { fireThrowCallback(invoker, invocation, result.getException()); } else { fireReturnCallback(invoker, invocation, result.getValue()); } } public void caught(Throwable exception) { fireThrowCallback(invoker, invocation, exception); } }); } }
public boolean isDone() { return future.isDone(); }
@SuppressWarnings("unchecked") public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { int timeoutInMillis = (int) unit.convert(timeout, TimeUnit.MILLISECONDS); try { return (V) (((Result) future.get(timeoutInMillis)).recreate()); } catch (com.alibaba.dubbo.remoting.TimeoutException e) { throw new TimeoutException(StringUtils.toString(e)); } catch (RemotingException e) { throw new ExecutionException(e.getMessage(), e); } catch (Throwable e) { throw new RpcException(e); } }
private void asyncCallback(final Invoker<?> invoker, final Invocation invocation) { Future<?> f = RpcContext.getContext().getFuture(); if (f instanceof FutureAdapter) { ResponseFuture future = ((FutureAdapter<?>)f).getFuture(); future.setCallback(new ResponseCallback() { public void done(Object rpcResult) { if (rpcResult == null){ logger.error(new IllegalStateException("invalid result value : null, expected "+Result.class.getName())); return; } ///must be rpcResult if (! (rpcResult instanceof Result)){ logger.error(new IllegalStateException("invalid result type :" + rpcResult.getClass() + ", expected "+Result.class.getName())); return; } Result result = (Result) rpcResult; if (result.hasException()) { fireThrowCallback(invoker, invocation, result.getException()); } else { fireReturnCallback(invoker, invocation, result.getValue()); } } public void caught(Throwable exception) { fireThrowCallback(invoker, invocation, exception); } }); } }
public boolean isDone() { return future.isDone(); }
@SuppressWarnings("unchecked") public V get() throws InterruptedException, ExecutionException { try { return (V) (((Result) future.get()).recreate()); } catch (RemotingException e) { throw new ExecutionException(e.getMessage(), e); } catch (Throwable e) { throw new RpcException(e); } }
private void asyncCallback(final Invoker<?> invoker, final Invocation invocation) { Future<?> f = RpcContext.getContext().getFuture(); if (f instanceof FutureAdapter) { ResponseFuture future = ((FutureAdapter<?>)f).getFuture(); future.setCallback(new ResponseCallback() { public void done(Object rpcResult) { if (rpcResult == null){ log.error("",new IllegalStateException("invalid result value : null, expected "+Result.class.getName())); return; } ///must be rpcResult if (! (rpcResult instanceof Result)){ log.error("",new IllegalStateException("invalid result type :" + rpcResult.getClass() + ", expected "+Result.class.getName())); return; } Result result = (Result) rpcResult; if (result.hasException()) { fireThrowCallback(invoker, invocation, result.getException()); } else { fireReturnCallback(invoker, invocation, result.getValue()); } } public void caught(Throwable exception) { fireThrowCallback(invoker, invocation, exception); } }); } }
public boolean isDone() { return future.isDone(); }
@SuppressWarnings("unchecked") public V get() throws InterruptedException, ExecutionException { try { return (V) (((Result) future.get()).recreate()); } catch (RemotingException e) { throw new ExecutionException(e.getMessage(), e); } catch (Throwable e) { throw new RpcException(e); } }
private void asyncCallback(final Invoker<?> invoker, final Invocation invocation) { Future<?> f = RpcContext.getContext().getFuture(); if (f instanceof FutureAdapter) { ResponseFuture future = ((FutureAdapter<?>)f).getFuture(); future.setCallback(new ResponseCallback() { public void done(Object rpcResult) { if (rpcResult == null){ logger.error(new IllegalStateException("invalid result value : null, expected "+Result.class.getName())); return; } ///must be rpcResult if (! (rpcResult instanceof Result)){ logger.error(new IllegalStateException("invalid result type :" + rpcResult.getClass() + ", expected "+Result.class.getName())); return; } Result result = (Result) rpcResult; if (result.hasException()) { fireThrowCallback(invoker, invocation, result.getException()); } else { fireReturnCallback(invoker, invocation, result.getValue()); } } public void caught(Throwable exception) { fireThrowCallback(invoker, invocation, exception); } }); } }
public boolean isDone() { return future.isDone(); }
@SuppressWarnings("unchecked") public V get() throws InterruptedException, ExecutionException { try { return (V) (((Result) future.get()).recreate()); } catch (RemotingException e) { throw new ExecutionException(e.getMessage(), e); } catch (Throwable e) { throw new RpcException(e); } }