call get(timeout, timeunit)
This commit is contained in:
parent
ee77897caf
commit
6256ec303d
|
|
@ -64,12 +64,6 @@ public class AsyncRpcResult extends AbstractResult {
|
|||
this.storedServerContext = RpcContext.getServerContext();
|
||||
}
|
||||
|
||||
public AsyncRpcResult(AsyncRpcResult asyncRpcResult) {
|
||||
this.invocation = asyncRpcResult.getInvocation();
|
||||
this.storedContext = asyncRpcResult.getStoredContext();
|
||||
this.storedServerContext = asyncRpcResult.getStoredServerContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notice the return type of {@link #getValue} is the actual type of the RPC method, not {@link AppResponse}
|
||||
*
|
||||
|
|
@ -144,7 +138,7 @@ public class AsyncRpcResult extends AbstractResult {
|
|||
|
||||
@Override
|
||||
public Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return this.get();
|
||||
return responseFuture.get(timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -196,18 +190,6 @@ public class AsyncRpcResult extends AbstractResult {
|
|||
getAppResponse().setAttachment(key, value);
|
||||
}
|
||||
|
||||
public RpcContext getStoredContext() {
|
||||
return storedContext;
|
||||
}
|
||||
|
||||
public RpcContext getStoredServerContext() {
|
||||
return storedServerContext;
|
||||
}
|
||||
|
||||
public Invocation getInvocation() {
|
||||
return invocation;
|
||||
}
|
||||
|
||||
public Executor getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ import org.apache.dubbo.rpc.RpcException;
|
|||
import org.apache.dubbo.rpc.RpcInvocation;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
|
||||
|
||||
/**
|
||||
* This class will work as a wrapper wrapping outside of each protocol invoker.
|
||||
|
|
@ -51,7 +55,7 @@ public class AsyncToSyncInvoker<T> implements Invoker<T> {
|
|||
|
||||
try {
|
||||
if (InvokeMode.SYNC == ((RpcInvocation)invocation).getInvokeMode()) {
|
||||
asyncResult.get();
|
||||
asyncResult.get(getUrl().getParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RpcException("Interrupted unexpectedly while waiting for remoting result to return! method: " + invocation.getMethodName() + ", provider: " + getUrl() + ", cause: " + e.getMessage(), e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue