public interface LatencyTracker
An implementation of this interface can be registered against a Cluster object trough the
Cluster.register(com.datastax.driver.core.Host.StateListener)
method, after which the update(Host, Statement, Exception,
long)
method will be called after each query of the driver to a Cassandra host with the
latency/duration (in nanoseconds) of this operation.
Modifier and Type | Method and Description |
---|---|
void |
onRegister(Cluster cluster)
Gets invoked when the tracker is registered with a cluster, or at cluster startup if the
tracker was registered at initialization with
Cluster.register(LatencyTracker) . |
void |
onUnregister(Cluster cluster)
Gets invoked when the tracker is unregistered from a cluster, or at cluster shutdown if the
tracker was not unregistered.
|
void |
update(Host host,
Statement statement,
Exception exception,
long newLatencyNanos)
A method that is called after each request to a Cassandra node with the duration of that
operation.
|
void update(Host host, Statement statement, Exception exception, long newLatencyNanos)
Note that there is no guarantee that this method won't be called concurrently by multiple threads, so implementations should synchronize internally if need be.
host
- The Cassandra host on which a request has been performed. This parameter is never
null
.statement
- The Statement
that has been executed. This
parameter is never null
.exception
- An Exception
thrown when receiving the response, or null
if
the response was successful.newLatencyNanos
- the latency in nanoseconds of the operation. This latency corresponds to
the time elapsed between when the query was sent to host
and when the response was
received by the driver (or the operation timed out, in which newLatencyNanos
will
approximately be the timeout value).void onRegister(Cluster cluster)
Cluster.register(LatencyTracker)
.cluster
- the cluster that this tracker is registered with.void onUnregister(Cluster cluster)
cluster
- the cluster that this tracker was registered with.Copyright © 2012–2024. All rights reserved.