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: 3161 $ $Date: 2016-10-05 16:40:19 -0400 (Wed, 05 Oct 2016) $
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.
 String getIdleTimeDuration()
          Returns the idle time as a duration.
 long getPrunePeriod()
          Returns the interval at which the prune task will be executed in seconds.
 String getPrunePeriodDuration()
          Returns the prune period as a duration.
 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 setIdleTimeDuration(String time)
          Sets the idle time.
 void setPrunePeriod(long period)
          Sets the prune period.
 void setPrunePeriodDuration(String 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

getPrunePeriodDuration

public String getPrunePeriodDuration()
Returns the prune period as a duration.

Returns:
prune period in duration syntax

setPrunePeriodDuration

public void setPrunePeriodDuration(String period)
Sets the prune period.

Parameters:
period - in duration syntax or in seconds

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

getIdleTimeDuration

public String getIdleTimeDuration()
Returns the idle time as a duration.

Returns:
idle time in duration syntax

setIdleTimeDuration

public void setIdleTimeDuration(String time)
Sets the idle time.

Parameters:
time - in duration syntax or in seconds

toString

public String toString()

Overrides:
toString in class Object


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