public class IdlePruneStrategy extends java.lang.Object implements PruneStrategy
| Modifier and Type | Field and Description |
|---|---|
private static long |
DEFAULT_IDLE_TIME
Default idle time in seconds.
|
private static long |
DEFAULT_PRUNE_PERIOD
Default prune period in seconds.
|
private static int |
DEFAULT_STATISTICS_SIZE
Default number of statistics to store.
|
private long |
idleTime
Idle time in seconds.
|
protected org.slf4j.Logger |
logger
Logger for this class.
|
private long |
prunePeriod
Prune period in seconds.
|
| Constructor and Description |
|---|
IdlePruneStrategy()
Creates a new idle prune strategy.
|
IdlePruneStrategy(long period,
long idle)
Creates a new idle prune strategy.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
java.lang.String |
toString() |
private static final int DEFAULT_STATISTICS_SIZE
private static final long DEFAULT_PRUNE_PERIOD
private static final long DEFAULT_IDLE_TIME
protected final org.slf4j.Logger logger
private long prunePeriod
private long idleTime
public IdlePruneStrategy()
public IdlePruneStrategy(long period,
long idle)
period - to execute the prune taskidle - time at which a connection should be prunedpublic boolean prune(PooledConnectionProxy conn)
PruneStrategyprune in interface PruneStrategyconn - that is available for pruningpublic int getStatisticsSize()
PruneStrategyPooledConnectionStatistics.getStatisticsSize in interface PruneStrategypublic long getPrunePeriod()
PruneStrategygetPrunePeriod in interface PruneStrategypublic void setPrunePeriod(long period)
period - to setpublic long getIdleTime()
public void setIdleTime(long time)
time - that a connection has been idle and should be prunedpublic java.lang.String toString()
toString in class java.lang.Object