Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatible problem with FutureAdapter #6126

Open
wikiwikiwiki opened this issue May 9, 2020 · 0 comments
Open

compatible problem with FutureAdapter #6126

wikiwikiwiki opened this issue May 9, 2020 · 0 comments

Comments

@wikiwikiwiki
Copy link

Environment

  • Dubbo version: 2.7.6
  • Operating System version: xxx
  • Java version: xxx

Steps to reproduce this issue

in dubbo, we can write async code like below:

import com.alibaba.dubbo.remoting.exchange.ResponseCallback;
import com.alibaba.dubbo.remoting.exchange.ResponseFuture;
import com.alibaba.dubbo.rpc.RpcContext;
import com.alibaba.dubbo.rpc.protocol.dubbo.FutureAdapter;
import com.alibaba.dubbo.rpc.Result;

interface TestService {
    String test();
}

testService.test();
ResponseFuture future = ((FutureAdapter) RpcContext.getContext().getFuture()).getFuture();
future.setCallback(new ResponseCallback(){
    public void done(Object response){
        assert response instanceof Result;// in 2.6.x
        assert response instanceof String;// in 2.7.x
    }

    public void caught(Throwable exception){
    }
});

however, response is an object of Result in 2.6.x but String in 2.7.x.
when project update to 2.7.x, we may find runtime error.

如果我们用上面的代码段做异步调用,在2.7.x里面,response会是一个String,但是在2.6.x,response会是一个com.alibaba.dubbo.rpc.Result。
如果从2.6升级到2.7,必须要查找所有进行调用的地方并修改代码,这不太合理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant