public class ClientStatusListenerExt
extends java.lang.Object
Client
in order to receive notifications
when certain events occur, such as backpressure or connection issues.
To use this class, implement one or more methods in a subclass and set it in your ClientConfig
object.Modifier and Type | Class and Description |
---|---|
static class |
ClientStatusListenerExt.AutoConnectionStatus
Cause of the connection creation failure.
|
static class |
ClientStatusListenerExt.DisconnectCause
Cause of the disconnection event.
|
Constructor and Description |
---|
ClientStatusListenerExt() |
Modifier and Type | Method and Description |
---|---|
void |
backpressure(boolean status)
Called by the client API whenever backpressure starts/stops.
|
void |
connectionCreated(java.lang.String hostname,
int port,
ClientStatusListenerExt.AutoConnectionStatus status)
Notify listeners that the client tried to create connection to unconnected nodes upon topology change.
|
void |
connectionLost(java.lang.String hostname,
int port,
int connectionsLeft,
ClientStatusListenerExt.DisconnectCause cause)
Notify listeners that a connection to a host was lost.
|
void |
lateProcedureResponse(ClientResponse r,
java.lang.String hostname,
int port)
Called when a response arrives on a connection that has already had its callback called
due to an elapsed timeout.
|
void |
uncaughtException(ProcedureCallback callback,
ClientResponse r,
java.lang.Throwable e)
Called when a
ProcedureCallback.clientCallback(ClientResponse) invocation throws
an exception. |
public void connectionLost(java.lang.String hostname, int port, int connectionsLeft, ClientStatusListenerExt.DisconnectCause cause)
hostname
- Name of the host the connection was lost from.port
- Port number of the connection to the lost host.connectionsLeft
- Number of remaining connections this client has to the DBcause
- The reason why this callback is being calledpublic void connectionCreated(java.lang.String hostname, int port, ClientStatusListenerExt.AutoConnectionStatus status)
hostname
- Name of the host the connection was created.port
- Port number of the connection to the node.status
- The creation statuspublic void backpressure(boolean status)
Client
will no longer
queue invocations.status
- true
if there is backpressure and false
otherwise.public void uncaughtException(ProcedureCallback callback, ClientResponse r, java.lang.Throwable e)
ProcedureCallback.clientCallback(ClientResponse)
invocation throws
an exception.callback
- The callback that threw an exception.r
- The response object passed to the callback.e
- The exception thrown by the callback.public void lateProcedureResponse(ClientResponse r, java.lang.String hostname, int port)
r
- The late response received.hostname
- The hostname or ip given at connection create time.port
- The port given at connection create time.