You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/11/22 07:40:36 UTC

[GitHub] [dubbo] mz0113 opened a new issue, #10987: ReferenceConfig在API编程时不可以每个方法单独一份config实例吗

mz0113 opened a new issue, #10987:
URL: https://github.com/apache/dubbo/issues/10987

   ` 
   //根据参数进行hash,各项参数一致的使用同一个referenceConfig 否则new一个新的config实例
           ReferenceWrapper referenceWrapper = referenceConfigMap.computeIfAbsent(referenceModel, key -> new ReferenceWrapper(referenceModel, createReference(referenceModel)));
   
   ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
           reference.setInterface(dubboInvokeParamModel.getServiceName());
           reference.setGroup(dubboInvokeParamModel.getGroup());
           reference.setVersion(dubboInvokeParamModel.getVersion());
           reference.setRetries(0);
   
          //例如这里,其他参数都一致,但是同一个method调用我可能因为需求不同而需要一会儿泛化,一会儿不泛化等情况。所以会new2个不同的referenceConfig实例
           reference.setGeneric(dubboInvokeParamModel.getGson() ? CommonConstants.GENERIC_SERIALIZATION_GSON : CommonConstants.GENERIC_SERIALIZATION_DEFAULT);
           reference.setAsync(dubboInvokeParamModel.getAsync());
           reference.setCheck(false);
           reference.setTimeout(dubboInvokeParamModel.getTimeoutMills());
   `
   
   如上 ,当interfaceName和group和version都一致 我会有不同超时时间,是否异步,不同泛化调用类型的需求。我希望能对于每一种调用维度维护不同的referenceConfig实例。
   然后问题就出现啦:假如我现在interfaceName,group和version都一致。然后下面有2个method 。 method1对应的实例的timeout是3000,method2对应的referenceConfig实例的timeout=4000  ,然后呢我再new一个新的method2的referenceConfig实例,超时时间改成5000. 
   但其实测试下来并不能正常工作,超时检测报错出来显示timeout还是4000而不是修改后的5000.即便我很确定拿到的referenceConfig实例里面显示的timeout变量已经是5000了


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] mz0113 closed issue #10987: ReferenceConfig在API编程时不可以每个方法单独一份config实例吗

Posted by GitBox <gi...@apache.org>.
mz0113 closed issue #10987: ReferenceConfig在API编程时不可以每个方法单独一份config实例吗
URL: https://github.com/apache/dubbo/issues/10987


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org