类 AppResponse
- java.lang.Object
-
- org.apache.dubbo.rpc.AppResponse
-
- 所有已实现的接口:
Serializable
,Result
- 直接已知子类:
DecodeableRpcResult
public class AppResponse extends Object implements Result
AsyncRpcResult
is introduced in 3.0.0 to replace RpcResult, and RpcResult is replaced withAppResponse
:- AsyncRpcResult is the object that is actually passed in the call chain
- AppResponse only simply represents the business result
The relationship between them can be described as follow, an abstraction of the definition of AsyncRpcResult:
{@code Public class AsyncRpcResult implements CompletionStage
AsyncRpcResult is a future representing an unfinished RPC call, while AppResponse is the actual return type of this call. In theory, AppResponse does'n have to implement the {@link Result} interface, this is done mainly for compatibility purpose.{ ...... } - 另请参阅:
- 序列化表格
-
-
构造器概要
构造器 构造器 说明 AppResponse()
AppResponse(Object result)
AppResponse(Throwable exception)
AppResponse(Invocation invocation)
-
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 void
addAttachments(Map<String,String> map)
Add the specified map to existing attachments in this instance.void
addObjectAttachments(Map<String,Object> map)
Add the specified map to existing attachments in this instance.void
clear()
Result
get()
Result
get(long timeout, TimeUnit unit)
String
getAttachment(String key)
get attachment by key.String
getAttachment(String key, String defaultValue)
get attachment by key with default value.Map<String,String>
getAttachments()
已过时。Object
getAttribute(String key)
Throwable
getException()
Get exception.Object
getObjectAttachment(String key)
get attachment by key.Object
getObjectAttachment(String key, Object defaultValue)
get attachment by key with default value.Map<String,Object>
getObjectAttachments()
get attachments.Object
getValue()
Get invoke result.boolean
hasException()
Has exception.Object
recreate()
Recreate.void
setAttachment(String key, Object value)
void
setAttachment(String key, String value)
void
setAttachments(Map<String,String> map)
Append all items from the map into the attachment, if map is empty then nothing happensvoid
setAttribute(String key, Object value)
void
setException(Throwable e)
void
setObjectAttachment(String key, Object value)
void
setObjectAttachments(Map<String,Object> map)
Replace the existing attachments with the specified param.void
setValue(Object value)
<U> CompletableFuture<U>
thenApply(Function<Result,? extends U> fn)
String
toString()
Result
whenCompleteWithContext(BiConsumer<Result,Throwable> fn)
Add a callback which can be triggered when the RPC call finishes.
-
-
-
构造器详细资料
-
AppResponse
public AppResponse()
-
AppResponse
public AppResponse(Invocation invocation)
-
AppResponse
public AppResponse(Object result)
-
AppResponse
public AppResponse(Throwable exception)
-
-
方法详细资料
-
recreate
public Object recreate() throws Throwable
从接口复制的说明:Result
Recreate.if (hasException()) { throw getException(); } else { return getValue(); }
-
getException
public Throwable getException()
从接口复制的说明:Result
Get exception.- 指定者:
getException
在接口中Result
- 返回:
- exception. if no exception return null.
-
setException
public void setException(Throwable e)
- 指定者:
setException
在接口中Result
-
hasException
public boolean hasException()
从接口复制的说明:Result
Has exception.- 指定者:
hasException
在接口中Result
- 返回:
- has exception.
-
getAttachments
@Deprecated public Map<String,String> getAttachments()
已过时。从接口复制的说明:Result
get attachments.- 指定者:
getAttachments
在接口中Result
- 返回:
- attachments.
-
getObjectAttachments
public Map<String,Object> getObjectAttachments()
从接口复制的说明:Result
get attachments.- 指定者:
getObjectAttachments
在接口中Result
- 返回:
- attachments.
-
setAttachments
public void setAttachments(Map<String,String> map)
Append all items from the map into the attachment, if map is empty then nothing happens- 指定者:
setAttachments
在接口中Result
- 参数:
map
- contains all key-value pairs to append
-
setObjectAttachments
public void setObjectAttachments(Map<String,Object> map)
从接口复制的说明:Result
Replace the existing attachments with the specified param.- 指定者:
setObjectAttachments
在接口中Result
-
addAttachments
public void addAttachments(Map<String,String> map)
从接口复制的说明:Result
Add the specified map to existing attachments in this instance.- 指定者:
addAttachments
在接口中Result
-
addObjectAttachments
public void addObjectAttachments(Map<String,Object> map)
从接口复制的说明:Result
Add the specified map to existing attachments in this instance.- 指定者:
addObjectAttachments
在接口中Result
-
getAttachment
public String getAttachment(String key)
从接口复制的说明:Result
get attachment by key.- 指定者:
getAttachment
在接口中Result
- 返回:
- attachment value.
-
getObjectAttachment
public Object getObjectAttachment(String key)
从接口复制的说明:Result
get attachment by key.- 指定者:
getObjectAttachment
在接口中Result
- 返回:
- attachment value.
-
getAttachment
public String getAttachment(String key, String defaultValue)
从接口复制的说明:Result
get attachment by key with default value.- 指定者:
getAttachment
在接口中Result
- 返回:
- attachment value.
-
getObjectAttachment
public Object getObjectAttachment(String key, Object defaultValue)
从接口复制的说明:Result
get attachment by key with default value.- 指定者:
getObjectAttachment
在接口中Result
- 返回:
- attachment value.
-
setAttachment
public void setAttachment(String key, String value)
- 指定者:
setAttachment
在接口中Result
-
setAttachment
public void setAttachment(String key, Object value)
- 指定者:
setAttachment
在接口中Result
-
setObjectAttachment
public void setObjectAttachment(String key, Object value)
- 指定者:
setObjectAttachment
在接口中Result
-
whenCompleteWithContext
public Result whenCompleteWithContext(BiConsumer<Result,Throwable> fn)
从接口复制的说明:Result
Add a callback which can be triggered when the RPC call finishes.Just as the method name implies, this method will guarantee the callback being triggered under the same context as when the call was started, see implementation in
Result.whenCompleteWithContext(BiConsumer)
- 指定者:
whenCompleteWithContext
在接口中Result
- 返回:
-
thenApply
public <U> CompletableFuture<U> thenApply(Function<Result,? extends U> fn)
-
get
public Result get() throws InterruptedException, ExecutionException
- 指定者:
get
在接口中Result
- 抛出:
InterruptedException
ExecutionException
-
get
public Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- 指定者:
get
在接口中Result
- 抛出:
InterruptedException
ExecutionException
TimeoutException
-
clear
public void clear()
-
-