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 2021/10/27 09:26:15 UTC
[GitHub] [dubbo] AlbumenJ commented on pull request #9111: [3.0] Optimization code of ClassUtils
AlbumenJ commented on pull request #9111:
URL: https://github.com/apache/dubbo/pull/9111#issuecomment-952721021
> For the Converter interface, if I could go from sourceType to targetType, it certain can be convert from targetType to sourceType. But the Converter interface does not support it. In fact, there are corresponding application scenarios,For example, RpcUtils transforms timeout.
>
> ```java
> private static long convertToNumber(Object obj, long defaultTimeout) {
> long timeout = 0;
> try {
> if (obj instanceof String) {
> timeout = Long.parseLong((String) obj);
> } else if (obj instanceof Number) {
> timeout = ((Number) obj).longValue();
> } else {
> timeout = Long.parseLong(obj.toString());
> }
> } catch (Exception e) {
> // ignore
> }
> return timeout;
> }
> ```
>
> By the way, there is a bug that the defaultTimeout does not take effect.
What is your opinion? Anything we could do to prevent this?
--
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