Improve default block fallback logic in Dubbo 2.6.x adapter to avoid serialization problem (#1794)
- convert BlockException to a simple RuntimeException (with necessary message)
This commit is contained in:
parent
d510eb6cd3
commit
9936b4da60
|
|
@ -29,7 +29,9 @@ public class DefaultDubboFallback implements DubboFallback {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) {
|
public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) {
|
||||||
// Just wrap the exception.
|
// Just wrap the exception. edit by wzg923 2020/9/23
|
||||||
return new RpcResult(new SentinelRpcException(ex));
|
RpcResult result = new RpcResult();
|
||||||
|
result.setException(new SentinelRpcException(ex.toRuntimeException()));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import com.alibaba.dubbo.rpc.Invocation;
|
||||||
import com.alibaba.dubbo.rpc.Invoker;
|
import com.alibaba.dubbo.rpc.Invoker;
|
||||||
import com.alibaba.dubbo.rpc.Result;
|
import com.alibaba.dubbo.rpc.Result;
|
||||||
import com.alibaba.dubbo.rpc.RpcResult;
|
import com.alibaba.dubbo.rpc.RpcResult;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue