krystalics opened a new issue #8262:
URL: https://github.com/apache/dolphinscheduler/issues/8262


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   env:
   macos monterey 12.0.1
   java version 1.8.0_241
   ---
   when I add a method in org.apache.dolphinscheduler.rpc.IUserService and 
implement in UserService
   ```java
   public interface IUserService {
   
       @Rpc(async = true, serviceCallback = UserCallback.class)
       Boolean say(String s);
   
       Integer hi(int num);
   
       @Rpc(async = true)
       Boolean callBackIsFalse(String s);
   
       //the method i add
       @Rpc(async = true, serviceCallback = UserCallback.class)
       String returnType(String type);
   }
   ```
   in test, it happend a error
   
![image](https://user-images.githubusercontent.com/22393849/151664834-f44e96b8-b4f4-4736-b5e8-c0c868fe1903.png)
   
   
   
   ### What you expected to happen
   
   it should be success no matter what type the method return !
   the bug is because the dynamic proxy mechanism.When it calls a asynchronous 
rpc method,it should return a null value firstly,and wait for the really 
response to callback.
   in this module,it wirte the true to result,which only suitable for Boolean 
return type. 
   org.apache.dolphinscheduler.rpc.client.ConsumerInterceptor::intercept()
   ```java
   //...other code
   while (retries-- > 0) {
       RpcResponse rsp;
       rsp = nettyClient.sendMsg(host, protocol, async);
       //success
       if (null != rsp && rsp.getStatus() == 0) {
           return rsp.getResult();
       }
   }
   //...other code
   ```
   org.apache.dolphinscheduler.rpc.remote.NettyClient::sendMsg()
   ```java
   if (Boolean.TRUE.equals(async)) {
         result = new RpcResponse();
         result.setStatus((byte) 0);
         result.setResult(true);
         return result;
   }
   ```
   
   the intercept()'s result should be the type of method return. but the code 
is always 'true' , so it happens the error: string can't be cast to boolean 
   
   ### How to reproduce
   
   just add a test method which return type is not Boolean in IUserService.
   
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   dev
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to