@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class PruneUnneededConnectionsLDAPConnectionPoolHealthCheck extends LDAPConnectionPoolHealthCheck
AbstractConnectionPool.getHealthCheckIntervalMillis()
method, so it
is possible that the number of available connections may have dipped below
that minimum on one or more occasions between checks. Also note that this
health check can only be used on instances of the
LDAPConnectionPool
class; it cannot be used with
LDAPThreadLocalConnectionPool
instances.Constructor and Description |
---|
PruneUnneededConnectionsLDAPConnectionPoolHealthCheck(int minAvailableConnections,
long minDurationMillisExceedingMinAvailableConnections)
Creates a new instance of this LDAP connection pool health check with the
provided information.
|
Modifier and Type | Method and Description |
---|---|
int |
getMinAvailableConnections()
Retrieves the minimum number of connections that should be maintained in
the connection pool.
|
long |
getMinDurationMillisExceedingMinAvailableConnections()
Retrieves the minimum length of time in milliseconds that the pool should
have reported at least the specified minimum number of available
connections before any connections may be removed.
|
void |
performPoolMaintenance(AbstractConnectionPool pool)
Performs any processing that may be appropriate on an ongoing basis for the
connection pool that is related to the pool itself rather than any
individual connection.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection pool health check
to the provided buffer.
|
ensureConnectionValidAfterAuthentication, ensureConnectionValidAfterException, ensureConnectionValidForCheckout, ensureConnectionValidForContinuedUse, ensureConnectionValidForRelease, ensureNewConnectionValid, toString
public PruneUnneededConnectionsLDAPConnectionPoolHealthCheck(int minAvailableConnections, long minDurationMillisExceedingMinAvailableConnections)
minAvailableConnections
- The minimum number of connections that should be maintained in
the connection pool. This health check will only remove
connections if the pool has more than this number of
connections for at least the specified duration. A value that
is less than or equal to zero indicates that no minimum number
of connections needs to be maintained.minDurationMillisExceedingMinAvailableConnections
- The minimum length of time in milliseconds that the pool
should have reported at least the specified minimum number of
available connections before any connections may be removed.
Note that the number of connections will only be checked at
intervals specified by the
AbstractConnectionPool.getHealthCheckIntervalMillis()
method, so it may be possible for the number of available
connections to dip below this value one or more time between
intervals and still cause the pool to be reduced in size. A
value that is less than or equal to zero indicates that the
pool size should be reduced to the configured minimum any time
there are more than that number of connections available.public int getMinAvailableConnections()
public long getMinDurationMillisExceedingMinAvailableConnections()
AbstractConnectionPool.getHealthCheckIntervalMillis()
method, so it
may be possible for the number of available connections to dip below this
value one or more time between intervals and still cause the pool to be
reduced in size.public void performPoolMaintenance(@NotNull AbstractConnectionPool pool)
LDAPConnectionPoolHealthCheckThread
at an interval specified by the
pool's AbstractConnectionPool.getHealthCheckIntervalMillis()
method. This method will be invoked after all other periodic processing
(for example, after calling LDAPConnectionPoolHealthCheck.ensureConnectionValidForContinuedUse(com.unboundid.ldap.sdk.LDAPConnection)
on each available connection, if appropriate for the pool implementation)
has been performed during the interval.performPoolMaintenance
in class LDAPConnectionPoolHealthCheck
pool
- The connection pool on which to perform maintenance.public void toString(@NotNull java.lang.StringBuilder buffer)
toString
in class LDAPConnectionPoolHealthCheck
buffer
- The buffer to which the information should be appended.