public abstract class JsonRpcClient extends Object implements JsonRpcRequestSender, Closeable
Modifier and Type | Field and Description |
---|---|
protected boolean |
closedByClient |
protected int |
connectionTimeout |
protected JsonRpcHandlerManager |
handlerManager |
protected boolean |
heartbeating |
protected int |
heartbeatInterval |
protected int |
idleTimeout |
protected String |
label |
static org.slf4j.Logger |
log |
protected 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) |
long |
getConnectionTimeout()
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.
|
Session |
getSession() |
boolean |
isClosedByUser()
Returns the closed state of the client.
|
void |
sendNotification(String method) |
void |
sendNotification(String method,
Object params) |
void |
sendNotification(String method,
Object params,
Continuation<com.google.gson.JsonElement> continuation) |
Response<com.google.gson.JsonElement> |
sendRequest(Request<com.google.gson.JsonObject> request) |
void |
sendRequest(Request<com.google.gson.JsonObject> request,
Continuation<Response<com.google.gson.JsonElement>> continuation) |
com.google.gson.JsonElement |
sendRequest(String method) |
<R> R |
sendRequest(String method,
Class<R> resultClass) |
void |
sendRequest(String method,
com.google.gson.JsonObject params,
Continuation<com.google.gson.JsonElement> continuation) |
com.google.gson.JsonElement |
sendRequest(String method,
Object params) |
<R> R |
sendRequest(String method,
Object params,
Class<R> resultClass) |
Response<com.google.gson.JsonElement> |
sendRequestHonorId(Request<com.google.gson.JsonObject> request) |
void |
sendRequestHonorId(Request<com.google.gson.JsonObject> request,
Continuation<Response<com.google.gson.JsonElement>> continuation) |
void |
setConnectionTimeout(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(String label) |
abstract void |
setRequestTimeout(long requesTimeout) |
void |
setServerRequestHandler(JsonRpcHandler<?> handler) |
void |
setSessionId(String sessionId) |
public static org.slf4j.Logger log
protected JsonRpcHandlerManager handlerManager
protected JsonRpcRequestSenderHelper rsHelper
protected Object registerInfo
protected ClientSession session
protected String label
protected int connectionTimeout
protected int idleTimeout
protected int heartbeatInterval
protected boolean heartbeating
protected boolean closedByClient
public void setServerRequestHandler(JsonRpcHandler<?> handler)
public void setLabel(String label)
public <R> R sendRequest(String method, Class<R> resultClass) throws IOException
sendRequest
in interface JsonRpcRequestSender
IOException
public <R> R sendRequest(String method, Object params, Class<R> resultClass) throws IOException
sendRequest
in interface JsonRpcRequestSender
IOException
public com.google.gson.JsonElement sendRequest(String method) throws IOException
sendRequest
in interface JsonRpcRequestSender
IOException
public com.google.gson.JsonElement sendRequest(String method, Object params) throws IOException
sendRequest
in interface JsonRpcRequestSender
IOException
public void sendRequest(String method, com.google.gson.JsonObject params, Continuation<com.google.gson.JsonElement> continuation)
sendRequest
in interface JsonRpcRequestSender
public void sendNotification(String method) throws IOException
sendNotification
in interface JsonRpcRequestSender
IOException
public void sendNotification(String method, Object params, Continuation<com.google.gson.JsonElement> continuation) throws IOException
sendNotification
in interface JsonRpcRequestSender
IOException
public void sendNotification(String method, Object params) throws IOException
sendNotification
in interface JsonRpcRequestSender
IOException
public Response<com.google.gson.JsonElement> sendRequest(Request<com.google.gson.JsonObject> request) throws IOException
sendRequest
in interface JsonRpcRequestSender
IOException
public void sendRequest(Request<com.google.gson.JsonObject> request, Continuation<Response<com.google.gson.JsonElement>> continuation) throws IOException
sendRequest
in interface JsonRpcRequestSender
IOException
public void sendRequestHonorId(Request<com.google.gson.JsonObject> request, Continuation<Response<com.google.gson.JsonElement>> continuation) throws IOException
sendRequestHonorId
in interface JsonRpcRequestSender
IOException
public Response<com.google.gson.JsonElement> sendRequestHonorId(Request<com.google.gson.JsonObject> request) throws IOException
sendRequestHonorId
in interface JsonRpcRequestSender
IOException
public Session getSession()
public void setSessionId(String sessionId)
public long getConnectionTimeout()
public void setConnectionTimeout(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 IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- if an I/O error occurs when closing this client.#isClosed
protected void closeWithReconnection() throws IOException
IOException
public abstract void setRequestTimeout(long requesTimeout)
public boolean isClosedByUser()
close()
Copyright © 2017 Kurento. All rights reserved.