public class RRClient
extends java.lang.Object
Constructor and Description |
---|
RRClient(java.lang.String host,
int port,
Config cfg,
Progress looper,
int wId,
ConnectHandler cHandler) |
Modifier and Type | Method and Description |
---|---|
boolean |
connect() |
void |
disconnect() |
void |
disconnectGraceFully(long waitTime) |
boolean |
isConnected() |
void |
registerMessage(Message.Builder builder)
Register a message type for sending
|
void |
registerResponseHandler(Message.Builder builder,
MessageHandler handler)
Register a response handler to a specific message type
|
RequestID |
sendRequest(Message message) |
Tuple<RequestID,Message> |
sendRequestWaitResponse(Message message,
long waitLimit)
return requestID and response message
throw an exception with the failure reason
|
void |
setHostAndPort(java.lang.String host,
int port) |
void |
tryConnecting() |
public RRClient(java.lang.String host, int port, Config cfg, Progress looper, int wId, ConnectHandler cHandler)
public void setHostAndPort(java.lang.String host, int port)
public boolean connect()
public void tryConnecting()
public void disconnect()
public void disconnectGraceFully(long waitTime)
public boolean isConnected()
public Tuple<RequestID,Message> sendRequestWaitResponse(Message message, long waitLimit) throws BlockingSendException
message
- messagewaitLimit
- waitlimitBlockingSendException
public RequestID sendRequest(Message message)
public void registerResponseHandler(Message.Builder builder, MessageHandler handler)
builder
- the response message typehandler
- the message callbackpublic void registerMessage(Message.Builder builder)
builder
- the message type