public abstract class AbstractClientService extends Object implements ClientService
| 限定符和类型 | 字段和说明 |
|---|---|
protected static org.slf4j.Logger |
LOG |
protected RpcClient |
rpcClient |
protected ThreadPoolExecutor |
rpcExecutor |
protected RpcOptions |
rpcOptions |
| 构造器和说明 |
|---|
AbstractClientService() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
checkConnection(Endpoint endpoint,
boolean createIfAbsent)
Check connection for given address and async to create a new one if there is no connection.
|
protected void |
configRpcClient(RpcClient rpcClient) |
boolean |
connect(Endpoint endpoint)
Connect to endpoint, returns true when success.
|
boolean |
disconnect(Endpoint endpoint)
Disconnect from endpoint.
|
RpcClient |
getRpcClient() |
boolean |
init(RpcOptions rpcOptions)
Initialize the service.
|
protected boolean |
initRpcClient(int rpcProcessorThreadPoolSize) |
<T extends com.google.protobuf.Message> |
invokeWithDone(Endpoint endpoint,
com.google.protobuf.Message request,
InvokeContext ctx,
RpcResponseClosure<T> done,
int timeoutMs) |
<T extends com.google.protobuf.Message> |
invokeWithDone(Endpoint endpoint,
com.google.protobuf.Message request,
InvokeContext ctx,
RpcResponseClosure<T> done,
int timeoutMs,
Executor rpcExecutor) |
<T extends com.google.protobuf.Message> |
invokeWithDone(Endpoint endpoint,
com.google.protobuf.Message request,
RpcResponseClosure<T> done,
int timeoutMs)
Send a requests and waits for response with callback, returns the request future.
|
<T extends com.google.protobuf.Message> |
invokeWithDone(Endpoint endpoint,
com.google.protobuf.Message request,
RpcResponseClosure<T> done,
int timeoutMs,
Executor rpcExecutor) |
boolean |
isConnected(Endpoint endpoint)
Returns true when the endpoint's connection is active.
|
void |
shutdown()
Dispose the resources for service.
|
protected static final org.slf4j.Logger LOG
protected volatile RpcClient rpcClient
protected ThreadPoolExecutor rpcExecutor
protected RpcOptions rpcOptions
public RpcClient getRpcClient()
public boolean isConnected(Endpoint endpoint)
ClientServiceisConnected 在接口中 ClientServiceendpoint - server addresspublic boolean checkConnection(Endpoint endpoint, boolean createIfAbsent)
ClientServicecheckConnection 在接口中 ClientServiceendpoint - target addresscreateIfAbsent - create a new one if there is no connectionpublic boolean init(RpcOptions rpcOptions)
Lifecycleinit 在接口中 Lifecycle<RpcOptions>protected void configRpcClient(RpcClient rpcClient)
protected boolean initRpcClient(int rpcProcessorThreadPoolSize)
public void shutdown()
Lifecycleshutdown 在接口中 Lifecycle<RpcOptions>public boolean connect(Endpoint endpoint)
ClientServiceconnect 在接口中 ClientServiceendpoint - server addresspublic boolean disconnect(Endpoint endpoint)
ClientServicedisconnect 在接口中 ClientServiceendpoint - server addresspublic <T extends com.google.protobuf.Message> Future<com.google.protobuf.Message> invokeWithDone(Endpoint endpoint, com.google.protobuf.Message request, RpcResponseClosure<T> done, int timeoutMs)
ClientServiceinvokeWithDone 在接口中 ClientServiceendpoint - server addressrequest - request datadone - callbacktimeoutMs - timeout millispublic <T extends com.google.protobuf.Message> Future<com.google.protobuf.Message> invokeWithDone(Endpoint endpoint, com.google.protobuf.Message request, RpcResponseClosure<T> done, int timeoutMs, Executor rpcExecutor)
public <T extends com.google.protobuf.Message> Future<com.google.protobuf.Message> invokeWithDone(Endpoint endpoint, com.google.protobuf.Message request, InvokeContext ctx, RpcResponseClosure<T> done, int timeoutMs)
public <T extends com.google.protobuf.Message> Future<com.google.protobuf.Message> invokeWithDone(Endpoint endpoint, com.google.protobuf.Message request, InvokeContext ctx, RpcResponseClosure<T> done, int timeoutMs, Executor rpcExecutor)
Copyright © 2021. All rights reserved.