public class RpcClient extends AbstractBoltClient
| 限定符和类型 | 字段和说明 |
|---|---|
protected RpcRemoting |
rpcRemoting |
| 构造器和说明 |
|---|
RpcClient() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addConnectionEventProcessor(ConnectionEventType type,
ConnectionEventProcessor processor)
Add processor to process connection event.
|
boolean |
checkConnection(String address)
check connection, the address format example - 127.0.0.1:12200?
|
boolean |
checkConnection(String address,
boolean createIfAbsent)
check connection, the address format example - 127.0.0.1:12200?
|
boolean |
checkConnection(String address,
boolean createIfAbsent,
boolean createAsync)
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 address,
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 |
disableConnectionMonitorSwitch()
disable connection monitor switch off
Notice: This api should be called before
init() |
void |
disableConnHeartbeat(String address)
Disable heart beat for a certain connection.
|
void |
disableConnHeartbeat(Url url)
Disable heart beat for a certain connection.
|
void |
disableReconnectSwith()
disable connection reconnect switch off
Notice: This api should be called before
init() |
void |
enableConnectionMonitorSwitch()
enable connection monitor switch on
|
void |
enableConnHeartbeat(String address)
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 address,
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. |
DefaultConnectionManager |
getConnectionManager()
Getter method for property connectionManager.
|
void |
init()
已过时。
|
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 BoltClient.invokeSync(Connection, Object, int) |
Object |
invokeSync(String address,
Object request,
int timeoutMillis)
Synchronous invocation using a string address, address format example - 127.0.0.1:12200?
|
Object |
invokeSync(String address,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Synchronous invocation with a
InvokeContext, common api notice please see BoltClient.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 BoltClient.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 BoltClient.invokeWithCallback(Connection, Object, InvokeCallback, int) |
void |
invokeWithCallback(String address,
Object request,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation using a string address, address format example - 127.0.0.1:12200?
|
void |
invokeWithCallback(String address,
Object request,
InvokeContext invokeContext,
InvokeCallback invokeCallback,
int timeoutMillis)
Callback invocation with a
InvokeContext, common api notice please see BoltClient.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 BoltClient.invokeWithCallback(Url, Object, InvokeCallback, int) |
RpcResponseFuture |
invokeWithFuture(Connection conn,
Object request,
int timeoutMillis)
|
RpcResponseFuture |
invokeWithFuture(Connection conn,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a
InvokeContext, common api notice please see BoltClient.invokeWithFuture(Connection, Object, int) |
RpcResponseFuture |
invokeWithFuture(String address,
Object request,
int timeoutMillis)
Future invocation using a string address, address format example - 127.0.0.1:12200?
|
RpcResponseFuture |
invokeWithFuture(String address,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a
InvokeContext, common api notice please see BoltClient.invokeWithFuture(String, Object, int) |
RpcResponseFuture |
invokeWithFuture(Url url,
Object request,
int timeoutMillis)
|
RpcResponseFuture |
invokeWithFuture(Url url,
Object request,
InvokeContext invokeContext,
int timeoutMillis)
Future invocation with a
InvokeContext, common api notice please see BoltClient.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 BoltClient.oneway(Connection, Object) |
void |
oneway(String address,
Object request)
One way invocation using a string address, address format example - 127.0.0.1:12200?
|
void |
oneway(String address,
Object request,
InvokeContext invokeContext)
Oneway invocation with a
InvokeContext, common api notice please see BoltClient.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 BoltClient.oneway(Url, Object) |
void |
registerUserProcessor(UserProcessor<?> processor)
Use UserProcessorRegisterHelper
UserProcessorRegisterHelper to help 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.
|
void |
startup() |
conf, initWriteBufferWaterMark, netty_buffer_high_watermark, netty_buffer_low_watermark, option, option, switchesensureStarted, isStartedprotected RpcRemoting rpcRemoting
@Deprecated public void init()
startup() insteadpublic void shutdown()
Notice:
shutdown 在接口中 LifeCycleshutdown 在类中 AbstractLifeCyclepublic void startup()
throws LifeCycleException
startup 在接口中 LifeCyclestartup 在类中 AbstractLifeCycleLifeCycleExceptionpublic void oneway(String address, Object request) throws RemotingException, InterruptedException
BoltClient
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]
BoltClient.closeConnection(String addr) to close it if you want.
address - target addressrequest - requestRemotingExceptionInterruptedExceptionpublic void oneway(String address, Object request, InvokeContext invokeContext) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.oneway(Connection, Object)address - target addressrequest - requestinvokeContext - invoke contextRemotingExceptionInterruptedExceptionpublic void oneway(Url url, Object request) throws RemotingException, InterruptedException
BoltClientUrl
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.
BoltClient.closeConnection(Url url) to close it if you want.
url - target urlrequest - objectRemotingExceptionInterruptedExceptionpublic void oneway(Url url, Object request, InvokeContext invokeContext) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.oneway(Url, Object)url - urlrequest - requestinvokeContext - invoke contextRemotingExceptionInterruptedExceptionpublic void oneway(Connection conn, Object request) throws RemotingException
BoltClientConnection
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - target connectionrequest - requestRemotingExceptionpublic void oneway(Connection conn, Object request, InvokeContext invokeContext) throws RemotingException
BoltClientInvokeContext, common api notice please see BoltClient.oneway(Connection, Object)conn - target connectionrequest - requestinvokeContext - invoke contextRemotingExceptionpublic Object invokeSync(String address, Object request, int timeoutMillis) throws RemotingException, InterruptedException
BoltClient
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]
BoltClient.closeConnection(String addr) to close it if you want.
address - target addressrequest - requesttimeoutMillis - timeout millisecondRemotingExceptionInterruptedExceptionpublic Object invokeSync(String address, Object request, InvokeContext invokeContext, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.invokeSync(String, Object, int)address - target addressrequest - requestinvokeContext - invoke contexttimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic Object invokeSync(Url url, Object request, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientUrl
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.
BoltClient.closeConnection(Url url) to close it if you want.
url - target urlrequest - requesttimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic Object invokeSync(Url url, Object request, InvokeContext invokeContext, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.invokeSync(Url, Object, int)url - target urlrequest - requestinvokeContext - invoke contexttimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic Object invokeSync(Connection conn, Object request, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientConnection
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - target connectionrequest - requesttimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic Object invokeSync(Connection conn, Object request, InvokeContext invokeContext, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.invokeSync(Connection, Object, int)conn - target connectionrequest - requestinvokeContext - invoke contexttimeoutMillis - timeout in millisRemotingExceptionInterruptedExceptionpublic RpcResponseFuture invokeWithFuture(String address, Object request, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientRpcResponseFuture.
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]
BoltClient.closeConnection(String addr) to close it if you want.
address - target addressrequest - requesttimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic RpcResponseFuture invokeWithFuture(String address, Object request, InvokeContext invokeContext, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.invokeWithFuture(String, Object, int)address - target addressrequest - requestinvokeContext - invoke contexttimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic RpcResponseFuture invokeWithFuture(Url url, Object request, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientUrl 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.
BoltClient.closeConnection(Url url) to close it if you want.
url - target urlrequest - requesttimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic RpcResponseFuture invokeWithFuture(Url url, Object request, InvokeContext invokeContext, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.invokeWithFuture(Url, Object, int)url - target urlrequest - requestinvokeContext - invoke contexttimeoutMillis - timeout in millisRemotingExceptionInterruptedExceptionpublic RpcResponseFuture invokeWithFuture(Connection conn, Object request, int timeoutMillis) throws RemotingException
BoltClientConnection RpcResponseFuture.
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - target connectionrequest - requesttimeoutMillis - timeout in millisRemotingExceptionpublic RpcResponseFuture invokeWithFuture(Connection conn, Object request, InvokeContext invokeContext, int timeoutMillis) throws RemotingException
BoltClientInvokeContext, common api notice please see BoltClient.invokeWithFuture(Connection, Object, int)conn - target connectionrequest - requestinvokeContext - contexttimeoutMillis - timeout millisecondRemotingExceptionpublic void invokeWithCallback(String address, Object request, InvokeCallback invokeCallback, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientInvokeCallback 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]
BoltClient.closeConnection(String addr) to close it if you want.
address - target addressrequest - requestinvokeCallback - callbacktimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic void invokeWithCallback(String address, Object request, InvokeContext invokeContext, InvokeCallback invokeCallback, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.invokeWithCallback(String, Object, InvokeCallback, int)address - target addressrequest - requestinvokeContext - contextinvokeCallback - callbacktimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic void invokeWithCallback(Url url, Object request, InvokeCallback invokeCallback, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientUrl 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.
BoltClient.closeConnection(Url url) to close it if you want.
url - target urlrequest - requestinvokeCallback - callbacktimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic void invokeWithCallback(Url url, Object request, InvokeContext invokeContext, InvokeCallback invokeCallback, int timeoutMillis) throws RemotingException, InterruptedException
BoltClientInvokeContext, common api notice please see BoltClient.invokeWithCallback(Url, Object, InvokeCallback, int)url - target urlrequest - requestinvokeContext - contextinvokeCallback - callbacktimeoutMillis - timeout in millisecondRemotingExceptionInterruptedExceptionpublic void invokeWithCallback(Connection conn, Object request, InvokeCallback invokeCallback, int timeoutMillis) throws RemotingException
BoltClientConnection InvokeCallback to get the result.
Notice:
DO NOT modify the request object concurrently when this method is called.
conn - target connectionrequest - requestinvokeCallback - callbacktimeoutMillis - timeout in millisecondRemotingExceptionpublic void invokeWithCallback(Connection conn, Object request, InvokeContext invokeContext, InvokeCallback invokeCallback, int timeoutMillis) throws RemotingException
BoltClientInvokeContext, common api notice please see BoltClient.invokeWithCallback(Connection, Object, InvokeCallback, int)conn - target connectionrequest - requestinvokeContext - invoke contextinvokeCallback - callbacktimeoutMillis - timeout in millisecondRemotingExceptionpublic void addConnectionEventProcessor(ConnectionEventType type, ConnectionEventProcessor processor)
BoltClienttype - connection event typeprocessor - connection event processpublic void registerUserProcessor(UserProcessor<?> processor)
BoltClientUserProcessorRegisterHelper to help register user processor for client side.public Connection createStandaloneConnection(String ip, int port, int connectTimeout) throws RemotingException
BoltClient
Notice:
BoltClient.closeStandaloneConnection(com.alipay.remoting.Connection) to close it.ip - ipport - portconnectTimeout - timeout in millisecondRemotingExceptionpublic Connection createStandaloneConnection(String address, int connectTimeout) throws RemotingException
BoltClient
Notice:
BoltClient.closeStandaloneConnection(com.alipay.remoting.Connection) to close it.
address - target addressconnectTimeout - timeout in millisecondRemotingExceptionpublic void closeStandaloneConnection(Connection conn)
BoltClientconn - target connectionpublic Connection getConnection(String address, int connectTimeout) throws RemotingException, InterruptedException
BoltClient
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
BoltClient.closeConnection(String addr) to close it.
address - target addressconnectTimeout - this is prior to url args RpcConfigs.CONNECT_TIMEOUT_KEYRemotingExceptionInterruptedExceptionpublic Connection getConnection(Url url, int connectTimeout) throws RemotingException, InterruptedException
BoltClientUrl.Notice:
ConnectionPool
BoltClient.closeConnection(Url url) to close it.
url - target urlconnectTimeout - this is prior to url args RpcConfigs.CONNECT_TIMEOUT_KEYRemotingExceptionInterruptedExceptionpublic Map<String,List<Connection>> getAllManagedConnections()
BoltClientpublic boolean checkConnection(String address)
BoltClientaddress - target addresspublic boolean checkConnection(String address, boolean createIfAbsent)
BoltClientaddress - target addresscreateIfAbsent - if need to createpublic boolean checkConnection(String address, boolean createIfAbsent, boolean createAsync)
BoltClientaddress - target addresscreateIfAbsent - if need to createcreateAsync - create connection asynchronouspublic void closeConnection(String addr)
addr - addresspublic void closeConnection(Url url)
BoltClientUrlurl - target urlpublic void enableConnHeartbeat(String address)
BoltClientNotice: this method takes no effect on a stand alone connection.
address - target addresspublic void enableConnHeartbeat(Url url)
BoltClientUrl not connected, then do nothing.
Notice: this method takes no effect on a stand alone connection.
url - target urlpublic void disableConnHeartbeat(String address)
BoltClientNotice: this method takes no effect on a stand alone connection.
address - target addresspublic void disableConnHeartbeat(Url url)
BoltClientUrl not connected, then do nothing.
Notice: this method takes no effect on a stand alone connection.
url - target urlpublic void enableReconnectSwitch()
BoltClient
Notice: This api should be called before init()
public void disableReconnectSwith()
BoltClient
Notice: This api should be called before init()
public boolean isReconnectSwitchOn()
BoltClientpublic void enableConnectionMonitorSwitch()
BoltClientpublic void disableConnectionMonitorSwitch()
BoltClient
Notice: This api should be called before init()
public boolean isConnectionMonitorSwitchOn()
BoltClientpublic DefaultConnectionManager getConnectionManager()
BoltClientpublic RemotingAddressParser getAddressParser()
BoltClientpublic void setAddressParser(RemotingAddressParser addressParser)
BoltClientaddressParser - value to be assigned to property addressParserpublic void setMonitorStrategy(ConnectionMonitorStrategy monitorStrategy)
BoltClientmonitorStrategy - value to be assigned to property monitorStrategyCopyright © 2020. All rights reserved.