Fix alibaba Filter / Result Compact (#12440)
This commit is contained in:
parent
f750b66a31
commit
057dcb4512
|
|
@ -18,6 +18,9 @@
|
|||
package com.alibaba.dubbo.rpc;
|
||||
|
||||
import org.apache.dubbo.rpc.AsyncRpcResult;
|
||||
import org.apache.dubbo.rpc.AttachmentsAdapter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Deprecated
|
||||
public interface Filter extends org.apache.dubbo.rpc.Filter {
|
||||
|
|
@ -27,7 +30,7 @@ public interface Filter extends org.apache.dubbo.rpc.Filter {
|
|||
@Override
|
||||
default org.apache.dubbo.rpc.Result invoke(org.apache.dubbo.rpc.Invoker<?> invoker,
|
||||
org.apache.dubbo.rpc.Invocation invocation)
|
||||
throws org.apache.dubbo.rpc.RpcException {
|
||||
throws org.apache.dubbo.rpc.RpcException {
|
||||
Result invokeResult = invoke(new Invoker.CompatibleInvoker<>(invoker),
|
||||
new Invocation.CompatibleInvocation(invocation));
|
||||
|
||||
|
|
@ -38,6 +41,10 @@ public interface Filter extends org.apache.dubbo.rpc.Filter {
|
|||
AsyncRpcResult asyncRpcResult = AsyncRpcResult.newDefaultAsyncResult(invocation);
|
||||
asyncRpcResult.setValue(invokeResult.getValue());
|
||||
asyncRpcResult.setException(invokeResult.getException());
|
||||
Map<String, String> attachments = invokeResult.getAttachments();
|
||||
if (!(attachments instanceof AttachmentsAdapter.ObjectToStringMap)) {
|
||||
asyncRpcResult.setAttachments(attachments);
|
||||
}
|
||||
asyncRpcResult.setObjectAttachments(invokeResult.getObjectAttachments());
|
||||
|
||||
return asyncRpcResult;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,16 @@ public interface Result extends org.apache.dubbo.rpc.Result {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see com.alibaba.dubbo.rpc.Result#getValue()
|
||||
* @deprecated Replace to getValue()
|
||||
*/
|
||||
@Deprecated
|
||||
default Object getResult() {
|
||||
return getValue();
|
||||
}
|
||||
|
||||
class CompatibleResult implements Result {
|
||||
private org.apache.dubbo.rpc.Result delegate;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue