org.ldaptive.pool
Class IdlePruneStrategy

java.lang.Object
  extended by org.ldaptive.pool.IdlePruneStrategy
All Implemented Interfaces:
PruneStrategy

public class IdlePruneStrategy
extends Object
implements PruneStrategy

Removes connections from the pool based on how long they have been idle in the available queue. By default this implementation executes every 5 minutes and prunes connections that have been idle for more than 10 minutes.

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services

Field Summary
protected  org.slf4j.Logger logger
          Logger for this class.
 
Constructor Summary
IdlePruneStrategy()
          Creates a new idle prune strategy.
IdlePruneStrategy(long period, long idle)
          Creates a new idle prune strategy.
 
Method Summary
 long getIdleTime()
          Returns the idle time.
 long getPrunePeriod()
          Returns the interval at which the prune task will be executed in seconds.
 int getStatisticsSize()
          Returns the number of statistics to store for this prune strategy.
 boolean prune(PooledConnectionProxy conn)
          Invoked to determine whether a connection should be pruned from the pool.
 void setIdleTime(long time)
          Sets the idle time.
 void setPrunePeriod(long period)
          Sets the prune period.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Logger for this class.

Constructor Detail

IdlePruneStrategy

public IdlePruneStrategy()
Creates a new idle prune strategy.


IdlePruneStrategy

public IdlePruneStrategy(long period,
                         long idle)
Creates a new idle prune strategy.

Parameters:
period - to execute the prune task
idle - time at which a connection should be pruned
Method Detail

prune

public boolean prune(PooledConnectionProxy conn)
Invoked to determine whether a connection should be pruned from the pool.

Specified by:
prune in interface PruneStrategy
Parameters:
conn - that is available for pruning
Returns:
whether the connection should be pruned

getStatisticsSize

public int getStatisticsSize()
Returns the number of statistics to store for this prune strategy. See PooledConnectionStatistics.

Specified by:
getStatisticsSize in interface PruneStrategy
Returns:
number of statistics to store

getPrunePeriod

public long getPrunePeriod()
Returns the interval at which the prune task will be executed in seconds.

Specified by:
getPrunePeriod in interface PruneStrategy
Returns:
prune period in seconds

setPrunePeriod

public void setPrunePeriod(long period)
Sets the prune period.

Parameters:
period - to set

getIdleTime

public long getIdleTime()
Returns the idle time.

Returns:
idle time

setIdleTime

public void setIdleTime(long time)
Sets the idle time.

Parameters:
time - that a connection has been idle and should be pruned

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2003-2015 Virginia Tech. All Rights Reserved.