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/12 03:25:56 UTC

[GitHub] [dubbo] sunhk commented on issue #8063: [坏味道]Dubbo代码中废弃声明方式很粗暴,建议增加解释说明

sunhk commented on issue #8063:
URL: https://github.com/apache/dubbo/issues/8063#issuecomment-940622492


   > 
   > 
   >     * [x]  I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
   > 
   >     * [x]  I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.
   > 
   > 
   > ### Environment
   > 
   >     * Dubbo version: *
   > 
   >     * Operating System version: *
   > 
   >     * Java version: *
   > 
   > 
   > ### Steps to reproduce this issue
   > 
   > ![image](https://user-images.githubusercontent.com/22830937/122164438-67ba7580-cea9-11eb-8bb7-2d55eaef9be2.png)
   > 
   > ![image](https://user-images.githubusercontent.com/22830937/122164460-6db05680-cea9-11eb-893b-5aba41659e78.png)
   > ### Expected Result
   > 
   > 建议声明替代方案,说明废弃的原因,最好能关联到issue、pr、文档 或者 dev邮件,样例如下。
   > 
   > ```java
   >     /**
   >      * @deprecated Use {@link #forNumber(int)} instead, 
   >      * see  https://github.com/apache/dubbo/issues/12345 for details.
   >      */
   >     @java.lang.Deprecated
   >     public static LEVEL valueOf(int value) {
   >       return forNumber(value);
   >     }
   > ```
   支持,升到3.0后发现org.apache.dubbo.rpc.RpcContext#getContext()变成了Deprecated,可官方文档却还是使用此方法:
   异步调用:https://dubbo.apache.org/zh/docs/advanced/async-call/#%E4%BD%BF%E7%94%A8-rpccontext
   隐式参数:https://dubbo.apache.org/zh/docs/advanced/attachment/
   路由规则:https://dubbo.apache.org/zh/docs/advanced/routing-rule/#consumer
   完全不知道怎么就Deprecated了,再看可能的替换方法:
   ```
       /**
        * Using to pass environment parameters in the whole invocation. For example, `remotingApplicationName`,
        * `remoteAddress`, etc. {@link RpcServiceContext}
        *
        * @return context
        */
       public static RpcServiceContext getServiceContext() {
           return SERVICE_CONTEXT.get();
       }
       /**
        * get server side context. ( A <-- B , in B side)
        *
        * @return server context
        */
       public static RpcContextAttachment getServerContext() {
           return SERVER_LOCAL.get();
       }
   ```java
   通过简单的注释完全看不出该怎么用,还没文档,只能去撸代码。。。
   


-- 
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