|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alibaba.dubbo.rpc.RpcContext
public class RpcContext
Thread local context. (API, ThreadLocal, ThreadSafe)
注意:RpcContext是一个临时状态记录器,当接收到RPC请求,或发起RPC请求时,RpcContext的状态都会变化。 比如:A调B,B再调C,则B机器上,在B调C之前,RpcContext记录的是A调B的信息,在B调C之后,RpcContext记录的是B调C的信息。
ContextFilter
Method Summary | ||
---|---|---|
|
asyncCall(Callable<T> callable)
异步调用 ,需要返回值,即使步调用Future.get方法,也会处理调用超时问题. |
|
void |
asyncCall(Runnable runable)
oneway调用,只发送请求,不接收返回结果. |
|
void |
clearAttachments()
|
|
Map<String,Object> |
get()
get values. |
|
Object |
get(String key)
get value. |
|
Object[] |
getArguments()
get arguments. |
|
String |
getAttachment(String key)
get attachment. |
|
Map<String,String> |
getAttachments()
get attachments. |
|
static RpcContext |
getContext()
get context. |
|
|
getFuture()
get future. |
|
Invocation |
getInvocation()
Deprecated. Replace to getMethodName(), getParameterTypes(), getArguments() |
|
Invoker<?> |
getInvoker()
Deprecated. Replace to getUrl() |
|
List<Invoker<?>> |
getInvokers()
Deprecated. Replace to getUrls() |
|
InetSocketAddress |
getLocalAddress()
get local address. |
|
String |
getLocalAddressString()
|
|
String |
getLocalHost()
get local host. |
|
String |
getLocalHostName()
get local host name. |
|
int |
getLocalPort()
get local port. |
|
String |
getMethodName()
get method name. |
|
Class<?>[] |
getParameterTypes()
get parameter types. |
|
InetSocketAddress |
getRemoteAddress()
get remote address. |
|
String |
getRemoteAddressString()
get remote address string. |
|
String |
getRemoteHost()
get remote host. |
|
String |
getRemoteHostName()
get remote host name. |
|
int |
getRemotePort()
get remote port. |
|
URL |
getUrl()
|
|
List<URL> |
getUrls()
|
|
boolean |
isClientSide()
Deprecated. Replace to isConsumerSide() |
|
boolean |
isConsumerSide()
is consumer side. |
|
boolean |
isProviderSide()
is provider side. |
|
boolean |
isServerSide()
Deprecated. Replace to isProviderSide() |
|
RpcContext |
remove(String key)
remove value. |
|
RpcContext |
removeAttachment(String key)
remove attachment. |
|
static void |
removeContext()
remove context. |
|
RpcContext |
set(String key,
Object value)
set value. |
|
void |
setArguments(Object[] arguments)
|
|
RpcContext |
setAttachment(String key,
String value)
set attachment. |
|
RpcContext |
setAttachments(Map<String,String> attachment)
set attachments |
|
void |
setFuture(Future<?> future)
set future. |
|
RpcContext |
setInvocation(Invocation invocation)
|
|
RpcContext |
setInvoker(Invoker<?> invoker)
|
|
RpcContext |
setInvokers(List<Invoker<?>> invokers)
|
|
RpcContext |
setLocalAddress(InetSocketAddress address)
set local address. |
|
RpcContext |
setLocalAddress(String host,
int port)
set local address. |
|
void |
setMethodName(String methodName)
|
|
void |
setParameterTypes(Class<?>[] parameterTypes)
|
|
RpcContext |
setRemoteAddress(InetSocketAddress address)
set remote address. |
|
RpcContext |
setRemoteAddress(String host,
int port)
set remote address. |
|
void |
setUrl(URL url)
|
|
void |
setUrls(List<URL> urls)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static RpcContext getContext()
public static void removeContext()
ContextFilter
public boolean isProviderSide()
public boolean isConsumerSide()
public <T> Future<T> getFuture()
T
-
public void setFuture(Future<?> future)
future
- public List<URL> getUrls()
public void setUrls(List<URL> urls)
public URL getUrl()
public void setUrl(URL url)
public String getMethodName()
public void setMethodName(String methodName)
public Class<?>[] getParameterTypes()
public void setParameterTypes(Class<?>[] parameterTypes)
public Object[] getArguments()
public void setArguments(Object[] arguments)
public RpcContext setLocalAddress(String host, int port)
host
- port
-
public InetSocketAddress getLocalAddress()
public RpcContext setLocalAddress(InetSocketAddress address)
address
-
public String getLocalAddressString()
public String getLocalHostName()
public RpcContext setRemoteAddress(String host, int port)
host
- port
-
public InetSocketAddress getRemoteAddress()
public RpcContext setRemoteAddress(InetSocketAddress address)
address
-
public String getRemoteAddressString()
public String getRemoteHostName()
public String getLocalHost()
public int getLocalPort()
public String getRemoteHost()
public int getRemotePort()
public String getAttachment(String key)
key
-
public RpcContext setAttachment(String key, String value)
key
- value
-
public RpcContext removeAttachment(String key)
key
-
public Map<String,String> getAttachments()
public RpcContext setAttachments(Map<String,String> attachment)
attachment
-
public void clearAttachments()
public Map<String,Object> get()
public RpcContext set(String key, Object value)
key
- value
-
public RpcContext remove(String key)
key
-
public Object get(String key)
key
-
@Deprecated public boolean isServerSide()
@Deprecated public boolean isClientSide()
@Deprecated public List<Invoker<?>> getInvokers()
public RpcContext setInvokers(List<Invoker<?>> invokers)
@Deprecated public Invoker<?> getInvoker()
public RpcContext setInvoker(Invoker<?> invoker)
@Deprecated public Invocation getInvocation()
public RpcContext setInvocation(Invocation invocation)
public <T> Future<T> asyncCall(Callable<T> callable)
callable
-
public void asyncCall(Runnable runable)
callable
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |