public class DefaultResponse extends Object implements Response, Traceable, Callbackable, Serializable
| Constructor and Description |
|---|
DefaultResponse() |
DefaultResponse(long requestId) |
DefaultResponse(Object value) |
DefaultResponse(Object value,
long requestId) |
DefaultResponse(Response response) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFinishCallback(Runnable runnable,
Executor executor) |
Map<String,String> |
getAttachments() |
Exception |
getException()
如果request处理有异常,那么调用该方法return exception 如果request还没处理完或者request处理正常,那么return null
|
long |
getProcessTime()
业务处理时间
|
long |
getRequestId()
与 Request 的 requestId 相对应
|
byte |
getRpcProtocolVersion() |
int |
getTimeout() |
TraceableContext |
getTraceableContext() |
Object |
getValue()
如果 request 正常处理,那么会返回 Object value,而如果 request 处理有异常,那么 getValue 会抛出异常
|
void |
onFinish() |
void |
setAttachment(String key,
String value) |
void |
setAttachments(Map<String,String> attachments) |
void |
setException(Exception exception) |
void |
setProcessTime(long time)
业务处理时间
|
void |
setRequestId(long requestId) |
void |
setRpcProtocolVersion(byte rpcProtocolVersion) |
void |
setValue(Object value) |
public DefaultResponse()
public DefaultResponse(long requestId)
public DefaultResponse(Response response)
public DefaultResponse(Object value)
public DefaultResponse(Object value, long requestId)
public Object getValue()
Response
如果 request 正常处理,那么会返回 Object value,而如果 request 处理有异常,那么 getValue 会抛出异常
public void setValue(Object value)
public Exception getException()
Response
该方法不会阻塞,无论该request是处理中还是处理完成
getException in interface Responsepublic void setException(Exception exception)
public long getRequestId()
ResponsegetRequestId in interface Responsepublic void setRequestId(long requestId)
public long getProcessTime()
ResponsegetProcessTime in interface Responsepublic void setProcessTime(long time)
ResponsesetProcessTime in interface Responsepublic int getTimeout()
getTimeout in interface Responsepublic Map<String,String> getAttachments()
getAttachments in interface Responsepublic void setAttachment(String key, String value)
setAttachment in interface Responsepublic byte getRpcProtocolVersion()
getRpcProtocolVersion in interface Responsepublic void setRpcProtocolVersion(byte rpcProtocolVersion)
setRpcProtocolVersion in interface Responsepublic void addFinishCallback(Runnable runnable, Executor executor)
addFinishCallback in interface Callbackablepublic void onFinish()
onFinish in interface Callbackablepublic TraceableContext getTraceableContext()
getTraceableContext in interface TraceableCopyright © 2019. All rights reserved.