Quellcode durchsuchen

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)
master
王振广 GitHub vor 4 Jahren
Ursprung
Commit
9936b4da60
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen
  1. +4
    -2
      sentinel-adapter/sentinel-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/fallback/DefaultDubboFallback.java
  2. +0
    -1
      sentinel-adapter/sentinel-dubbo-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/dubbo/fallback/DubboFallbackRegistryTest.java

+ 4
- 2
sentinel-adapter/sentinel-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/fallback/DefaultDubboFallback.java Datei anzeigen

@@ -29,7 +29,9 @@ public class DefaultDubboFallback implements DubboFallback {

@Override
public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) {
// Just wrap the exception.
return new RpcResult(new SentinelRpcException(ex));
// Just wrap the exception. edit by wzg923 2020/9/23
RpcResult result = new RpcResult();
result.setException(new SentinelRpcException(ex.toRuntimeException()));
return result;
}
}

+ 0
- 1
sentinel-adapter/sentinel-dubbo-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/dubbo/fallback/DubboFallbackRegistryTest.java Datei anzeigen

@@ -23,7 +23,6 @@ import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.Result;
import com.alibaba.dubbo.rpc.RpcResult;

import org.junit.Assert;
import org.junit.Test;



Laden…
Abbrechen
Speichern