public static interface Session.State
This mostly exposes information on the connections maintained by a Session: which host it is connected to, how many connections it has for each host, etc...
Modifier and Type | Method and Description |
---|---|
Collection<Host> |
getConnectedHosts()
The hosts to which the session is currently connected (more precisely, at the time this State
has been grabbed).
|
int |
getInFlightQueries(Host host)
The number of queries that are currently being executed through a given host.
|
int |
getOpenConnections(Host host)
The number of open connections to a given host.
|
Session |
getSession()
The Session to which this State corresponds to.
|
int |
getTrashedConnections(Host host)
The number of "trashed" connections to a given host.
|
Session getSession()
Collection<Host> getConnectedHosts()
Please note that this method really returns the hosts for which the session currently
holds a connection pool. As such, it's unlikely but not impossible for a host to be listed in
the output of this method but to have getOpenConnections
return 0, if the pool itself
is created but no connections have been successfully opened yet.
int getOpenConnections(Host host)
Note that this refers to active connections. The actual number of connections
also includes getTrashedConnections(Host)
.
host
- the host to get open connections for.host
. If the session is not connected to
that host, 0 is returned.int getTrashedConnections(Host host)
When the load to a host decreases, the driver will reclaim some connections in order to
save resources. No requests are sent to these connections anymore, but they are kept open for
an additional amount of time (PoolingOptions.getIdleTimeoutSeconds()
), in case the
load goes up again. This method counts connections in that state.
host
- the host to get trashed connections for.host
. If the session is not connected to
that host, 0 is returned.int getInFlightQueries(Host host)
This corresponds to the number of queries that have been sent (by the session this is a
State of) to the Cassandra Host on one of its connections but haven't yet returned. In that
sense this provides a sort of measure of how busy the connections to that node are (at the
time the State
was grabbed at least).
host
- the host to get in-flight queries for.host
.Copyright © 2012–2024. All rights reserved.