public class JsonRpcClient extends Object
ReactorClient
wrapper which provides ability to send single or batched requests.
Each send operation is represented by Call
future which is updated when response arrives.Constructor and Description |
---|
JsonRpcClient(ReactorClient client,
ResponseTracker tracker)
Wraps
ReactorClient to hide response update details. |
Modifier and Type | Method and Description |
---|---|
Future<List<JsonRpcResponse>> |
batchCall(List<JsonRpcRequest> requests)
Sends requests in batch and returns
Future representation of JsonRpcResponse . |
Future<JsonRpcResponse> |
call(JsonRpcRequest req)
Sends single request and returns
Future representation of JsonRpcResponse . |
void |
close() |
ReactorClient |
getClient() |
ClientPolicy |
getClientRetryPolicy() |
int |
getConnectionId() |
String |
getHostname() |
ClientPolicy |
getRetryPolicy() |
boolean |
isClosed() |
void |
processResponse(JsonRpcResponse response) |
void |
removeCall(Future<JsonRpcResponse> call) |
void |
setClientRetryPolicy(ClientPolicy policy) |
void |
setRetryPolicy(ClientPolicy policy) |
public JsonRpcClient(ReactorClient client, ResponseTracker tracker)
ReactorClient
to hide response update details.client
- - used to communicate.tracker
- - used for response tracking.public void setClientRetryPolicy(ClientPolicy policy)
public void setRetryPolicy(ClientPolicy policy)
public ClientPolicy getClientRetryPolicy()
public ClientPolicy getRetryPolicy()
public String getHostname()
public int getConnectionId()
public Future<JsonRpcResponse> call(JsonRpcRequest req) throws ClientConnectionException
Future
representation of JsonRpcResponse
.req
- - Request which is about to be sent.null
if sending failed.ClientConnectionException
- is thrown when connection issues occur.RequestAlreadySentException
- when the same requests is attempted to be send twice.public void removeCall(Future<JsonRpcResponse> call)
public Future<List<JsonRpcResponse>> batchCall(List<JsonRpcRequest> requests) throws ClientConnectionException
Future
representation of JsonRpcResponse
.requests
- - List
of requests to be sent.null
if sending failed.ClientConnectionException
- is thrown when connection issues occur.RequestAlreadySentException
- when the same requests is attempted to be send twice.public ReactorClient getClient() throws ClientConnectionException
ClientConnectionException
public void processResponse(JsonRpcResponse response)
public void close()
public boolean isClosed()
Copyright © 2016. All rights reserved.