Package com.unboundid.ldap.sdk
Class LDAPConnectionPoolStatistics
- java.lang.Object
-
- com.unboundid.ldap.sdk.LDAPConnectionPoolStatistics
-
- All Implemented Interfaces:
java.io.Serializable
@Mutable @ThreadSafety(level=MOSTLY_THREADSAFE) public final class LDAPConnectionPoolStatistics extends java.lang.Object implements java.io.Serializable
This class provides a data structure with information about usage of an LDAP connection pool. Calls to update statistics maintained by this class are threadsafe, but attempts to access different statistics may not be consistent if operations may be in progress in the connection pool.
The set of statistics maintained for connection pools include:- The current number of connections that are available within the pool.
- The maximum number of connections that may be available within the pool.
- The total number of connections that have been successfully checked out of the pool.
- The number of connections that have been successfully checked out of of the pool without needing to wait for a connection to become available.
- The number of connections that have been successfully checked out of the pool after waiting for a connection to become available.
- The number of connections that have been successfully checked out of the pool after creating a new connection to service the request.
- The number of failed attempts to check a connection out of the pool.
- The number of connections that have been released back to the pool as valid.
- The number of connections that have been closed as defunct.
- The number of connections that have been closed as expired (i.e., that had been established for the maximum connection age).
- The number of connections that have been closed as unneeded (because the pool already had the maximum number of available connections).
- The number of successful attempts to create a new connection for use in the pool.
- The number of failed attempts to create a new connection for use in the pool.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LDAPConnectionPoolStatistics(AbstractConnectionPool pool)
Creates a new instance of this LDAP connection pool statistics object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMaximumAvailableConnections()
Retrieves the maximum number of connections that may be available in the pool at any time, if that information is available.int
getNumAvailableConnections()
Retrieves the number of connections currently available for use in the pool, if that information is available.long
getNumConnectionsClosedDefunct()
Retrieves the number of connections that have been closed as defunct (i.e., they are no longer believed to be valid).long
getNumConnectionsClosedExpired()
Retrieves the number of connections that have been closed as expired (i.e., they have been established for longer than the maximum connection age for the pool).long
getNumConnectionsClosedUnneeded()
Retrieves the number of connections that have been closed as unneeded (i.e., they were created in response to heavy load but are no longer needed to meet the current load, or they were closed when the pool was closed).long
getNumFailedCheckouts()
Retrieves the number of failed attempts to check out a connection from the pool (including connections checked out for internal use by operations processed as part of the pool).long
getNumFailedConnectionAttempts()
Retrieves the number of failed attempts to create a connection for use in the connection pool.long
getNumReleasedValid()
Retrieves the number of times a valid, usable connection has been released back to the pool after being checked out (including connections checked out for internal use by operations processed within the pool).long
getNumSuccessfulCheckouts()
Retrieves the number of successful attempts to check out a connection from the pool (including connections checked out for internal use by operations processed as part of the pool).long
getNumSuccessfulCheckoutsAfterWaiting()
Retrieves the number of successful attempts to check out a connection from the pool that had to wait for a connection to become available.long
getNumSuccessfulCheckoutsNewConnection()
Retrieves the number of successful attempts to check out a connection from the pool that had to create a new connection because no existing connections were available.long
getNumSuccessfulCheckoutsWithoutWaiting()
Retrieves the number of successful attempts to check out a connection from the pool that were able to obtain an existing connection without waiting.long
getNumSuccessfulConnectionAttempts()
Retrieves the number of connections that have been successfully created for use in conjunction with the connection pool.void
reset()
Resets all counters back to zero.java.lang.String
toString()
Retrieves a string representation of this LDAP connection pool statistics object.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection pool statistics object to the provided buffer.
-
-
-
Constructor Detail
-
LDAPConnectionPoolStatistics
public LDAPConnectionPoolStatistics(@NotNull AbstractConnectionPool pool)
Creates a new instance of this LDAP connection pool statistics object. All of the counts will be initialized to zero.- Parameters:
pool
- The connection pool with which these statistics are associated.
-
-
Method Detail
-
reset
public void reset()
Resets all counters back to zero.
-
getNumSuccessfulConnectionAttempts
public long getNumSuccessfulConnectionAttempts()
Retrieves the number of connections that have been successfully created for use in conjunction with the connection pool.- Returns:
- The number of connections that have been created for use in conjunction with the connection pool.
-
getNumFailedConnectionAttempts
public long getNumFailedConnectionAttempts()
Retrieves the number of failed attempts to create a connection for use in the connection pool.- Returns:
- The number of failed attempts to create a connection for use in the connection pool.
-
getNumConnectionsClosedDefunct
public long getNumConnectionsClosedDefunct()
Retrieves the number of connections that have been closed as defunct (i.e., they are no longer believed to be valid).- Returns:
- The number of connections that have been closed as defunct.
-
getNumConnectionsClosedExpired
public long getNumConnectionsClosedExpired()
Retrieves the number of connections that have been closed as expired (i.e., they have been established for longer than the maximum connection age for the pool).- Returns:
- The number of connections that have been closed as expired.
-
getNumConnectionsClosedUnneeded
public long getNumConnectionsClosedUnneeded()
Retrieves the number of connections that have been closed as unneeded (i.e., they were created in response to heavy load but are no longer needed to meet the current load, or they were closed when the pool was closed).- Returns:
- The number of connections that have been closed as unneeded.
-
getNumSuccessfulCheckouts
public long getNumSuccessfulCheckouts()
Retrieves the number of successful attempts to check out a connection from the pool (including connections checked out for internal use by operations processed as part of the pool).- Returns:
- The number of successful attempts to check out a connection from the pool.
-
getNumSuccessfulCheckoutsWithoutWaiting
public long getNumSuccessfulCheckoutsWithoutWaiting()
Retrieves the number of successful attempts to check out a connection from the pool that were able to obtain an existing connection without waiting.- Returns:
- The number of successful attempts to check out a connection from the pool that were able to obtain an existing connection without waiting.
-
getNumSuccessfulCheckoutsAfterWaiting
public long getNumSuccessfulCheckoutsAfterWaiting()
Retrieves the number of successful attempts to check out a connection from the pool that had to wait for a connection to become available.- Returns:
- The number of successful attempts to check out a connection from the pool that had to wait for a connection to become available.
-
getNumSuccessfulCheckoutsNewConnection
public long getNumSuccessfulCheckoutsNewConnection()
Retrieves the number of successful attempts to check out a connection from the pool that had to create a new connection because no existing connections were available.- Returns:
- The number of successful attempts to check out a connection from the pool that had to create a new connection because no existing connections were available.
-
getNumFailedCheckouts
public long getNumFailedCheckouts()
Retrieves the number of failed attempts to check out a connection from the pool (including connections checked out for internal use by operations processed as part of the pool).- Returns:
- The number of failed attempts to check out a connection from the pool.
-
getNumReleasedValid
public long getNumReleasedValid()
Retrieves the number of times a valid, usable connection has been released back to the pool after being checked out (including connections checked out for internal use by operations processed within the pool).- Returns:
- The number of times a valid connection has been released back to the pool.
-
getNumAvailableConnections
public int getNumAvailableConnections()
Retrieves the number of connections currently available for use in the pool, if that information is available.- Returns:
- The number of connections currently available for use in the pool, or -1 if that is not applicable for the associated connection pool implementation.
-
getMaximumAvailableConnections
public int getMaximumAvailableConnections()
Retrieves the maximum number of connections that may be available in the pool at any time, if that information is available.- Returns:
- The maximum number of connections that may be available in the pool at any time, or -1 if that is not applicable for the associated connection pool implementation.
-
toString
@NotNull public java.lang.String toString()
Retrieves a string representation of this LDAP connection pool statistics object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this LDAP connection pool statistics object.
-
-