public abstract class JsonRpcClient extends java.lang.Object implements JsonRpcRequestSender, java.io.Closeable
Modifier and Type | Field and Description |
---|---|
protected int |
connectionTimeout |
protected JsonRpcHandlerManager |
handlerManager |
protected boolean |
heartbeating |
protected int |
heartbeatInterval |
protected int |
idleTimeout |
protected java.lang.String |
label |
static Logger |
log |
protected java.lang.Object |
registerInfo |
protected JsonRpcRequestSenderHelper |
rsHelper |
protected ClientSession |
session |
Constructor and Description |
---|
JsonRpcClient() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this client.
|
protected void |
closeWithReconnection() |
abstract void |
connect() |
void |
disableHeartbeat()
Disables the heratbeat mechanism.
|
void |
disableHeartbeat(boolean mayInterruptIfRunning)
Disables the heratbeat mechanism.
|
void |
enableHeartbeat() |
void |
enableHeartbeat(int interval) |
int |
getConnectionTimeoutValue()
Gets the connection timeout, in milliseconds, configured in the client.
|
int |
getHeartbeatInterval()
Gets the configured heartbeat interval in milliseconds.
|
int |
getIdleTimeout()
Gets the idle timeout (i.e. the time after which the session is
considered as idle if no messages have been exchanged), in milliseconds,
configured in the client.
|
Session |
getSession() |
boolean |
isClosed()
Returns the closed state of the client.
|
void |
sendNotification(java.lang.String method) |
void |
sendNotification(java.lang.String method,
java.lang.Object params) |
void |
sendNotification(java.lang.String method,
java.lang.Object params,
Continuation<JsonElement> continuation) |
Response<JsonElement> |
sendRequest(Request<JsonObject> request) |
void |
sendRequest(Request<JsonObject> request,
Continuation<Response<JsonElement>> continuation) |
JsonElement |
sendRequest(java.lang.String method) |
<R> R |
sendRequest(java.lang.String method,
java.lang.Class<R> resultClass) |
void |
sendRequest(java.lang.String method,
JsonObject params,
Continuation<JsonElement> continuation) |
JsonElement |
sendRequest(java.lang.String method,
java.lang.Object params) |
<R> R |
sendRequest(java.lang.String method,
java.lang.Object params,
java.lang.Class<R> resultClass) |
Response<JsonElement> |
sendRequestHonorId(Request<JsonObject> request) |
void |
sendRequestHonorId(Request<JsonObject> request,
Continuation<Response<JsonElement>> continuation) |
void |
setConnectionTimeoutValue(int connectionTimeout)
Sets a connection timeout in milliseconds in the client.
|
void |
setHeartbeatInterval(int interval)
Sets the heartbeat interval in milliseconds.
|
void |
setIdleTimeout(int idleTimeout)
Sets an idle timeout in milliseconds in the client.
|
void |
setLabel(java.lang.String label) |
abstract void |
setRequestTimeout(long requesTimeout) |
void |
setServerRequestHandler(JsonRpcHandler<?> handler) |
void |
setSessionId(java.lang.String sessionId) |
public static Logger log
protected JsonRpcHandlerManager handlerManager
protected JsonRpcRequestSenderHelper rsHelper
protected java.lang.Object registerInfo
protected ClientSession session
protected java.lang.String label
protected int connectionTimeout
protected int idleTimeout
protected int heartbeatInterval
protected boolean heartbeating
public void setServerRequestHandler(JsonRpcHandler<?> handler)
public void setLabel(java.lang.String label)
public <R> R sendRequest(java.lang.String method, java.lang.Class<R> resultClass) throws java.io.IOException
sendRequest
in interface JsonRpcRequestSender
java.io.IOException
public <R> R sendRequest(java.lang.String method, java.lang.Object params, java.lang.Class<R> resultClass) throws java.io.IOException
sendRequest
in interface JsonRpcRequestSender
java.io.IOException
public JsonElement sendRequest(java.lang.String method) throws java.io.IOException
sendRequest
in interface JsonRpcRequestSender
java.io.IOException
public JsonElement sendRequest(java.lang.String method, java.lang.Object params) throws java.io.IOException
sendRequest
in interface JsonRpcRequestSender
java.io.IOException
public void sendRequest(java.lang.String method, JsonObject params, Continuation<JsonElement> continuation)
sendRequest
in interface JsonRpcRequestSender
public void sendNotification(java.lang.String method) throws java.io.IOException
sendNotification
in interface JsonRpcRequestSender
java.io.IOException
public void sendNotification(java.lang.String method, java.lang.Object params, Continuation<JsonElement> continuation) throws java.io.IOException
sendNotification
in interface JsonRpcRequestSender
java.io.IOException
public void sendNotification(java.lang.String method, java.lang.Object params) throws java.io.IOException
sendNotification
in interface JsonRpcRequestSender
java.io.IOException
public Response<JsonElement> sendRequest(Request<JsonObject> request) throws java.io.IOException
sendRequest
in interface JsonRpcRequestSender
java.io.IOException
public void sendRequest(Request<JsonObject> request, Continuation<Response<JsonElement>> continuation) throws java.io.IOException
sendRequest
in interface JsonRpcRequestSender
java.io.IOException
public void sendRequestHonorId(Request<JsonObject> request, Continuation<Response<JsonElement>> continuation) throws java.io.IOException
sendRequestHonorId
in interface JsonRpcRequestSender
java.io.IOException
public Response<JsonElement> sendRequestHonorId(Request<JsonObject> request) throws java.io.IOException
sendRequestHonorId
in interface JsonRpcRequestSender
java.io.IOException
public Session getSession()
public void setSessionId(java.lang.String sessionId)
public int getConnectionTimeoutValue()
public void setConnectionTimeoutValue(int connectionTimeout)
JsonRpcWSConnectionListener.connectionFailed()
method will be
invoked, and a KurentoException
will be thrown.connectionTimeout
- the timeout in millisecondspublic int getIdleTimeout()
public void setIdleTimeout(int idleTimeout)
idleTimeout
- the timeout in millisecondspublic int getHeartbeatInterval()
public void setHeartbeatInterval(int interval)
interval
- in millisecondspublic void enableHeartbeat()
public void enableHeartbeat(int interval)
public void disableHeartbeat()
public void disableHeartbeat(boolean mayInterruptIfRunning)
mayInterruptIfRunning
- Signals the task to interrupt even if it is already runningpublic abstract void connect() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
- if an I/O error occurs when closing this client.isClosed()
protected void closeWithReconnection() throws java.io.IOException
java.io.IOException
public abstract void setRequestTimeout(long requesTimeout)
public boolean isClosed()
close()