Package org.voltdb.client
Class ClientStatusListenerExt
java.lang.Object
org.voltdb.client.ClientStatusListenerExt
Listener that a client application can provide to a
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.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Cause of the connection creation failure.static enum
Cause of the disconnection event. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
backpressure
(boolean status) Called by the client API whenever backpressure starts/stops.void
connectionCreated
(String hostname, int port, ClientStatusListenerExt.AutoConnectionStatus status) Notify listeners that the client tried to create connection to unconnected nodes upon topology change.void
connectionLost
(String hostname, int port, int connectionsLeft, ClientStatusListenerExt.DisconnectCause cause) Notify listeners that a connection to a host was lost.void
lateProcedureResponse
(ClientResponse r, 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, Throwable e) Called when aProcedureCallback.clientCallback(ClientResponse)
invocation throws an exception.
-
Constructor Details
-
ClientStatusListenerExt
public ClientStatusListenerExt()
-
-
Method Details
-
connectionLost
public void connectionLost(String hostname, int port, int connectionsLeft, ClientStatusListenerExt.DisconnectCause cause) Notify listeners that a connection to a host was lost.- Parameters:
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 called
-
connectionCreated
public void connectionCreated(String hostname, int port, ClientStatusListenerExt.AutoConnectionStatus status) Notify listeners that the client tried to create connection to unconnected nodes upon topology change. When topology-change awareness is enabled, connections to newly joined nodes or other unconnected nodes within the cluster will be created. This method will be invoked to notify the client upon a new connection is created. Client can override this method to keep track of the connections- Parameters:
hostname
- Name of the host the connection was created.port
- Port number of the connection to the node.status
- The creation status
-
backpressure
public void backpressure(boolean status) Called by the client API whenever backpressure starts/stops. Backpressure is a condition where all TCP connections to the servers are full and theClient
will no longer queue invocations.- Parameters:
status
-true
if there is backpressure andfalse
otherwise.
-
uncaughtException
Called when aProcedureCallback.clientCallback(ClientResponse)
invocation throws an exception.- Parameters:
callback
- The callback that threw an exception.r
- The response object passed to the callback.e
- The exception thrown by the callback.
-
lateProcedureResponse
Called when a response arrives on a connection that has already had its callback called due to an elapsed timeout.- Parameters:
r
- The late response received.hostname
- The hostname or ip given at connection create time.port
- The port given at connection create time.
-