This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 2.7.3-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/2.7.3-release by this push:
     new cfba520  support method sync timeout (#4436)
cfba520 is described below

commit cfba520104517b1570bce131808f3977b17326dc
Author: Haiyang <[email protected]>
AuthorDate: Tue Jul 2 11:02:52 2019 +0800

    support method sync timeout (#4436)
    
    fixes #4435
---
 .../main/java/org/apache/dubbo/rpc/protocol/AsyncToSyncInvoker.java  | 5 +++--
 .../main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java  | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AsyncToSyncInvoker.java
 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AsyncToSyncInvoker.java
index 93fb5d8..0d3af4d 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AsyncToSyncInvoker.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AsyncToSyncInvoker.java
@@ -34,6 +34,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
 
 /**
  * This class will work as a wrapper wrapping outside of each protocol invoker.
+ *
  * @param <T>
  */
 public class AsyncToSyncInvoker<T> implements Invoker<T> {
@@ -54,8 +55,8 @@ public class AsyncToSyncInvoker<T> implements Invoker<T> {
         Result asyncResult = invoker.invoke(invocation);
 
         try {
-            if (InvokeMode.SYNC == 
((RpcInvocation)invocation).getInvokeMode()) {
-                asyncResult.get(getUrl().getParameter(TIMEOUT_KEY, 
DEFAULT_TIMEOUT), TimeUnit.MILLISECONDS);
+            if (InvokeMode.SYNC == ((RpcInvocation) 
invocation).getInvokeMode()) {
+                asyncResult.get(Integer.MAX_VALUE, 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);
diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java
index ece7149..3fed73f 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java
@@ -87,7 +87,7 @@ public class DubboInvoker<T> extends AbstractInvoker<T> {
         }
         try {
             boolean isOneway = RpcUtils.isOneway(getUrl(), invocation);
-            int timeout = getUrl().getMethodParameter(methodName, TIMEOUT_KEY, 
DEFAULT_TIMEOUT);
+            int timeout = getUrl().getMethodPositiveParameter(methodName, 
TIMEOUT_KEY, DEFAULT_TIMEOUT);
             if (isOneway) {
                 boolean isSent = getUrl().getMethodParameter(methodName, 
Constants.SENT_KEY, false);
                 currentClient.send(inv, isSent);

Reply via email to