|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.alipay.remoting.rpc.RpcClient
public class RpcClient
Client for Rpc.
| Field Summary | |
|---|---|
protected RpcRemoting |
rpcRemoting
rpc remoting |
| Constructor Summary | |
|---|---|
RpcClient()
|
|
| Method Summary | |
|---|---|
void |
addConnectionEventProcessor(ConnectionEventType type,
ConnectionEventProcessor processor)
Add processor to process connection event. |
boolean |
checkConnection(String addr)
check connection, the address format example - 127.0.0.1:12200? |
void |
closeConnection(String addr)
Close all connections of a address |
void |
closeConnection(Url url)
Close all connections of a Url |
void |
closeStandaloneConnection(Connection conn)
Close a standalone connection |
Connection |
createStandaloneConnection(String addr,
int connectTimeout)
Create a stand alone connection using address, address format example - 127.0.0.1:12200 Notice: Each time you can this method, will create a new connection. |
Connection |
createStandaloneConnection(String ip,
int port,
int connectTimeout)
Create a stand alone connection using ip and port. |
void |
disableConnHeartbeat(String addr)
Disable heart beat for a certain connection. |
void |
disableConnHeartbeat(Url url)
Disable heart beat for a certain connection. |
void |
enableConnectionMonitorSwitch()
enable connection monitor switch on |
void |
enableConnHeartbeat(String addr)
Enable heart beat for a certain connection. |
void |
enableConnHeartbeat(Url url)
Enable heart beat for a certain connection. |
void |
enableReconnectSwitch()
enable connection reconnect switch on Notice: This api should be called before init() |
RemotingAddressParser |
getAddressParser()
Getter method for property addressParser. |
Map<String,List<Connection>> |
getAllManagedConnections()
get all connections managed by rpc client |
Connection |
getConnection(String addr,
int connectTimeout)
Get a connection using address, address format example - 127.0.0.1:12200? |
Connection |
getConnection(Url url,
int connectTimeout)
Get a connection using a Url. |
protected DefaultConnectionManager |
getConnectionManager()
|
void |
init()
Initialization. |
Object |
invokeSync(Connection conn,
Object request,
int timeoutMillis)
Synchronous invocation using a Connection Notice: DO NOT modify the request object concurrently when this method is called. |
Object |
invokeSync(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Synchronous invocation with a InvokeContext, common api notice please see invokeSync(Connection, Object, int) |
Object |
invokeSync(String addr,
Object request,
int timeoutMillis)
Synchronous invocation using a string address, address format example - 127.0.0.1:12200? |
Object |
invokeSync(String addr,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Synchronous invocation with a InvokeContext, common api notice please see invokeSync(String, Object, int) |
Object |
invokeSync(Url url,
Object request,
int timeoutMillis)
Synchronous invocation using a parsed Url Notice: DO NOT modify the request object concurrently when this method is called. |
Object |
invokeSync(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Synchronous invocation with a InvokeContext, common api notice please see invokeSync(Url, Object, int) |
void |
invokeWithCallback(Connection conn,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation using a Connection You can specify an implementation of InvokeCallback to get the result. |
void |
invokeWithCallback(Connection conn,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation with a InvokeContext, common api notice please see invokeWithCallback(Connection, Object, InvokeCallback, int) |
void |
invokeWithCallback(String addr,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation using a string address, address format example - 127.0.0.1:12200? |
void |
invokeWithCallback(String addr,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation with a InvokeContext, common api notice please see invokeWithCallback(String, Object, InvokeCallback, int) |
void |
invokeWithCallback(Url url,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation using a parsed Url You can specify an implementation of InvokeCallback to get the result. |
void |
invokeWithCallback(Url url,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation with a InvokeContext, common api notice please see invokeWithCallback(Url, Object, InvokeCallback, int) |
RpcResponseFuture |
invokeWithFuture(Connection conn,
Object request,
int timeoutMillis)
Future invocation using a Connection You can get result use the returned RpcResponseFuture. |
RpcResponseFuture |
invokeWithFuture(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a InvokeContext, common api notice please see invokeWithFuture(Connection, Object, int) |
RpcResponseFuture |
invokeWithFuture(String addr,
Object request,
int timeoutMillis)
Future invocation using a string address, address format example - 127.0.0.1:12200? |
RpcResponseFuture |
invokeWithFuture(String addr,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a InvokeContext, common api notice please see invokeWithFuture(String, Object, int) |
RpcResponseFuture |
invokeWithFuture(Url url,
Object request,
int timeoutMillis)
Future invocation using a parsed Url You can get result use the returned RpcResponseFuture. |
RpcResponseFuture |
invokeWithFuture(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a InvokeContext, common api notice please see invokeWithFuture(Url, Object, int) |
boolean |
isConnectionMonitorSwitchOn()
is connection monitor switch on |
boolean |
isReconnectSwitchOn()
is reconnect switch on |
void |
oneway(Connection conn,
Object request)
One way invocation using a Connection Notice: DO NOT modify the request object concurrently when this method is called. |
void |
oneway(Connection conn,
Object request,
InvokeContext invokeContext)
Oneway invocation with a InvokeContext, common api notice please see oneway(Connection, Object) |
void |
oneway(String addr,
Object request)
One way invocation using a string address, address format example - 127.0.0.1:12200? |
void |
oneway(String addr,
Object request,
InvokeContext invokeContext)
Oneway invocation with a InvokeContext, common api notice please see oneway(Connection, Object) |
void |
oneway(Url url,
Object request)
One way invocation using a parsed Url Notice: DO NOT modify the request object concurrently when this method is called. |
void |
oneway(Url url,
Object request,
InvokeContext invokeContext)
Oneway invocation with a InvokeContext, common api notice please see oneway(Url, Object) |
void |
registerUserProcessor(UserProcessor<?> processor)
Register user processor for client side. |
void |
setAddressParser(RemotingAddressParser addressParser)
Setter method for property addressParser. |
void |
setMonitorStrategy(ConnectionMonitorStrategy monitorStrategy)
Setter method for property monitorStrategy. |
void |
shutdown()
Shutdown. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected RpcRemoting rpcRemoting
| Constructor Detail |
|---|
public RpcClient()
| Method Detail |
|---|
public void init()
public void shutdown()
Notice:
public void oneway(String addr,
Object request)
throws RemotingException,
InterruptedException
Notice:
RpcConfigs.CONNECT_TIMEOUT_KEY to specify connection timeout, time unit is milliseconds, e.g [127.0.0.1:12200?_CONNECTTIMEOUT=3000]
RpcConfigs.CONNECTION_NUM_KEY to specify connection number for each ip and port, e.g [127.0.0.1:12200?_CONNECTIONNUM=30]
RpcConfigs.CONNECTION_WARMUP_KEY to specify whether need warmup all connections for the first time you call this method, e.g [127.0.0.1:12200?_CONNECTIONWARMUP=false]
closeConnection(String addr) to close it if you want.
addr - request -
RemotingException
InterruptedException
public void oneway(String addr,
Object request,
InvokeContext invokeContext)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see oneway(Connection, Object)
addr - request - invokeContext -
RemotingException
InterruptedException
public void oneway(Url url,
Object request)
throws RemotingException,
InterruptedException
Url
Notice:
Url to find a available connection, if none then create one.Url.setConnectTimeout(int) to specify connection timeout, time unit is milliseconds.
Url.setConnNum(int) to specify connection number for each ip and port.
Url.setConnWarmup(boolean) to specify whether need warmup all connections for the first time you call this method.
closeConnection(Url url) to close it if you want.
url - request -
RemotingException
InterruptedException
public void oneway(Url url,
Object request,
InvokeContext invokeContext)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see oneway(Url, Object)
url - request - invokeContext -
RemotingException
InterruptedException
public void oneway(Connection conn,
Object request)
throws RemotingException
Connection
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - request -
RemotingException
public void oneway(Connection conn,
Object request,
InvokeContext invokeContext)
throws RemotingException
InvokeContext, common api notice please see oneway(Connection, Object)
conn - request - invokeContext -
RemotingException
public Object invokeSync(String addr,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
Notice:
RpcConfigs.CONNECT_TIMEOUT_KEY to specify connection timeout, time unit is milliseconds, e.g [127.0.0.1:12200?_CONNECTTIMEOUT=3000]
RpcConfigs.CONNECTION_NUM_KEY to specify connection number for each ip and port, e.g [127.0.0.1:12200?_CONNECTIONNUM=30]
RpcConfigs.CONNECTION_WARMUP_KEY to specify whether need warmup all connections for the first time you call this method, e.g [127.0.0.1:12200?_CONNECTIONWARMUP=false]
closeConnection(String addr) to close it if you want.
addr - request - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(String addr,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeSync(String, Object, int)
addr - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(Url url,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
Url
Notice:
Url to find a available connection, if none then create one.Url.setConnectTimeout(int) to specify connection timeout, time unit is milliseconds.
Url.setConnNum(int) to specify connection number for each ip and port.
Url.setConnWarmup(boolean) to specify whether need warmup all connections for the first time you call this method.
closeConnection(Url url) to close it if you want.
url - request - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeSync(Url, Object, int)
url - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(Connection conn,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
Connection
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - request - timeoutMillis -
RemotingException
InterruptedException
public Object invokeSync(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeSync(Connection, Object, int)
conn - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(String addr,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
RpcResponseFuture.
Notice:
RpcConfigs.CONNECT_TIMEOUT_KEY to specify connection timeout, time unit is milliseconds, e.g [127.0.0.1:12200?_CONNECTTIMEOUT=3000]
RpcConfigs.CONNECTION_NUM_KEY to specify connection number for each ip and port, e.g [127.0.0.1:12200?_CONNECTIONNUM=30]
RpcConfigs.CONNECTION_WARMUP_KEY to specify whether need warmup all connections for the first time you call this method, e.g [127.0.0.1:12200?_CONNECTIONWARMUP=false]
closeConnection(String addr) to close it if you want.
addr - request - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(String addr,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeWithFuture(String, Object, int)
addr - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(Url url,
Object request,
int timeoutMillis)
throws RemotingException,
InterruptedException
Url RpcResponseFuture.
Notice:
Url to find a available connection, if none then create one.Url.setConnectTimeout(int) to specify connection timeout, time unit is milliseconds.
Url.setConnNum(int) to specify connection number for each ip and port.
Url.setConnWarmup(boolean) to specify whether need warmup all connections for the first time you call this method.
closeConnection(Url url) to close it if you want.
url - request - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeWithFuture(Url, Object, int)
url - request - invokeContext - timeoutMillis -
RemotingException
InterruptedException
public RpcResponseFuture invokeWithFuture(Connection conn,
Object request,
int timeoutMillis)
throws RemotingException
Connection RpcResponseFuture.
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - request - timeoutMillis -
RemotingException
public RpcResponseFuture invokeWithFuture(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
throws RemotingException
InvokeContext, common api notice please see invokeWithFuture(Connection, Object, int)
conn - request - invokeContext - timeoutMillis -
RemotingException
public void invokeWithCallback(String addr,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeCallback to get the result.
Notice:
RpcConfigs.CONNECT_TIMEOUT_KEY to specify connection timeout, time unit is milliseconds, e.g [127.0.0.1:12200?_CONNECTTIMEOUT=3000]
RpcConfigs.CONNECTION_NUM_KEY to specify connection number for each ip and port, e.g [127.0.0.1:12200?_CONNECTIONNUM=30]
RpcConfigs.CONNECTION_WARMUP_KEY to specify whether need warmup all connections for the first time you call this method, e.g [127.0.0.1:12200?_CONNECTIONWARMUP=false]
closeConnection(String addr) to close it if you want.
addr - request - invokeCallback - timeoutMillis -
RemotingException
InterruptedException
public void invokeWithCallback(String addr,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeWithCallback(String, Object, InvokeCallback, int)
addr - request - invokeContext - invokeCallback - timeoutMillis -
RemotingException
InterruptedException
public void invokeWithCallback(Url url,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException,
InterruptedException
Url InvokeCallback to get the result.
Notice:
Url to find a available connection, if none then create one.Url.setConnectTimeout(int) to specify connection timeout, time unit is milliseconds.
Url.setConnNum(int) to specify connection number for each ip and port.
Url.setConnWarmup(boolean) to specify whether need warmup all connections for the first time you call this method.
closeConnection(Url url) to close it if you want.
url - request - invokeCallback - timeoutMillis -
RemotingException
InterruptedException
public void invokeWithCallback(Url url,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException,
InterruptedException
InvokeContext, common api notice please see invokeWithCallback(Url, Object, InvokeCallback, int)
url - request - invokeContext - invokeCallback - timeoutMillis -
RemotingException
InterruptedException
public void invokeWithCallback(Connection conn,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException
Connection InvokeCallback to get the result.
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - request - invokeCallback - timeoutMillis -
RemotingException
public void invokeWithCallback(Connection conn,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
throws RemotingException
InvokeContext, common api notice please see invokeWithCallback(Connection, Object, InvokeCallback, int)
conn - request - invokeContext - invokeCallback - timeoutMillis -
RemotingException
public void addConnectionEventProcessor(ConnectionEventType type,
ConnectionEventProcessor processor)
type - processor - public void registerUserProcessor(UserProcessor<?> processor)
processor -
RemotingException
public Connection createStandaloneConnection(String ip,
int port,
int connectTimeout)
throws RemotingException
Notice:
closeStandaloneConnection(com.alipay.remoting.Connection) to close it.
ip - port - connectTimeout -
RemotingException
public Connection createStandaloneConnection(String addr,
int connectTimeout)
throws RemotingException
Notice:
closeStandaloneConnection(com.alipay.remoting.Connection) to close it.
addr - connectTimeout -
RemotingExceptionpublic void closeStandaloneConnection(Connection conn)
conn -
public Connection getConnection(String addr,
int connectTimeout)
throws RemotingException,
InterruptedException
Notice:
RpcConfigs.CONNECT_TIMEOUT_KEY to specify connection timeout, time unit is milliseconds, e.g [127.0.0.1:12200?_CONNECTTIMEOUT=3000]
RpcConfigs.CONNECTION_NUM_KEY to specify connection number for each ip and port, e.g [127.0.0.1:12200?_CONNECTIONNUM=30]
RpcConfigs.CONNECTION_WARMUP_KEY to specify whether need warmup all connections for the first time you call this method, e.g [127.0.0.1:12200?_CONNECTIONWARMUP=false]
ConnectionPool
closeConnection(String addr) to close it.
addr - connectTimeout - this is prior to url args RpcConfigs.CONNECT_TIMEOUT_KEY
RemotingException
InterruptedException
public Connection getConnection(Url url,
int connectTimeout)
throws RemotingException,
InterruptedException
Url.Notice:
ConnectionPool
closeConnection(Url url) to close it.
url - connectTimeout - this is prior to url args RpcConfigs.CONNECT_TIMEOUT_KEY
RemotingException
InterruptedExceptionpublic Map<String,List<Connection>> getAllManagedConnections()
public boolean checkConnection(String addr)
addr -
RemotingExceptionpublic void closeConnection(String addr)
addr - public void closeConnection(Url url)
Url
url - public void enableConnHeartbeat(String addr)
Notice: this method takes no effect on a stand alone connection.
addr - public void enableConnHeartbeat(Url url)
Url not connected, then do nothing.
Notice: this method takes no effect on a stand alone connection.
url - public void disableConnHeartbeat(String addr)
Notice: this method takes no effect on a stand alone connection.
addr - public void disableConnHeartbeat(Url url)
Url not connected, then do nothing.
Notice: this method takes no effect on a stand alone connection.
url - public void enableReconnectSwitch()
Notice: This api should be called before init()
public boolean isReconnectSwitchOn()
public void enableConnectionMonitorSwitch()
public boolean isConnectionMonitorSwitchOn()
protected DefaultConnectionManager getConnectionManager()
public RemotingAddressParser getAddressParser()
public void setAddressParser(RemotingAddressParser addressParser)
addressParser - value to be assigned to property addressParserpublic void setMonitorStrategy(ConnectionMonitorStrategy monitorStrategy)
monitorStrategy - value to be assigned to property monitorStrategy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||