public class RpcInvokeContext extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected ResponseFuture<?> |
future
The Future.
|
protected static ThreadLocal<RpcInvokeContext> |
LOCAL
线程上下文变量
|
protected ConcurrentMap<String,Object> |
map
自定义属性
|
protected Map<String,String> |
requestBaggage
请求上的透传数据
|
protected Map<String,String> |
responseBaggage
响应上的透传数据
|
protected SofaResponseCallback |
responseCallback
用户自定义Callback,单次调用生效
|
protected String |
targetGroup
用户自定义对方分组
|
protected String |
targetURL
用户自定义对方地址,单次调用生效
|
protected Integer |
timeout
用户自定义超时时间,单次调用生效
|
| 构造器和说明 |
|---|
RpcInvokeContext() |
protected static final ThreadLocal<RpcInvokeContext> LOCAL
protected Integer timeout
protected String targetURL
protected String targetGroup
protected SofaResponseCallback responseCallback
protected ResponseFuture<?> future
protected ConcurrentMap<String,Object> map
public static RpcInvokeContext getContext()
public static RpcInvokeContext peekContext()
public static void removeContext()
public static void setContext(RpcInvokeContext context)
context - 调用上下文public static boolean isBaggageEnable()
public Integer getTimeout()
public RpcInvokeContext setTimeout(Integer timeout)
timeout - 超时时间public void putRequestBaggage(String key, String value)
key - Keyvalue - Valuepublic String removeRequestBaggage(String key)
key - Keypublic void putAllRequestBaggage(Map<String,String> requestBaggage)
requestBaggage - 请求透传数据public void putResponseBaggage(String key, String value)
key - Keyvalue - Valuepublic String removeResponseBaggage(String key)
key - Keypublic void putAllResponseBaggage(Map<String,String> responseBaggage)
responseBaggage - 响应透传数据public String getTargetURL()
public RpcInvokeContext setTargetURL(String targetURL)
targetURL - 单次请求的指定地址public String getTargetGroup()
public RpcInvokeContext setTargetGroup(String targetGroup)
targetGroup - 单次请求的指定分组public SofaResponseCallback getResponseCallback()
public RpcInvokeContext setResponseCallback(SofaResponseCallback responseCallback)
responseCallback - 单次请求的指定回调方法public <T> ResponseFuture<T> getFuture()
T - 返回值类型public RpcInvokeContext setFuture(ResponseFuture<?> future)
future - Future对象Copyright © 2008–2018 The Ant Financial. All rights reserved.