public class IdlePruneStrategy extends Object implements PruneStrategy
| Modifier and Type | Field and Description |
|---|---|
private static Duration |
DEFAULT_IDLE_TIME
Default idle time.
|
private static Duration |
DEFAULT_PRUNE_PERIOD
Default prune period in seconds.
|
private static int |
DEFAULT_STATISTICS_SIZE
Default number of statistics to store.
|
private Duration |
idleTime
Idle time.
|
protected Logger |
logger
Logger for this class.
|
private Duration |
prunePeriod
Prune period.
|
| Constructor and Description |
|---|
IdlePruneStrategy()
Creates a new idle prune strategy.
|
IdlePruneStrategy(Duration period,
Duration idle)
Creates a new idle prune strategy.
|
| Modifier and Type | Method and Description |
|---|---|
Duration |
getIdleTime()
Returns the idle time.
|
Duration |
getPrunePeriod()
Returns the interval at which the prune task will be executed.
|
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(Duration time)
Sets the idle time.
|
void |
setPrunePeriod(Duration period)
Sets the prune period.
|
String |
toString() |
private static final int DEFAULT_STATISTICS_SIZE
private static final Duration DEFAULT_PRUNE_PERIOD
private static final Duration DEFAULT_IDLE_TIME
protected final Logger logger
private Duration prunePeriod
private Duration idleTime
public boolean prune(PooledConnectionProxy conn)
PruneStrategyprune in interface PruneStrategyconn - that is available for pruningpublic int getStatisticsSize()
PruneStrategyPooledConnectionStatistics.getStatisticsSize in interface PruneStrategypublic Duration getPrunePeriod()
PruneStrategygetPrunePeriod in interface PruneStrategypublic void setPrunePeriod(Duration period)
period - to setpublic Duration getIdleTime()
public void setIdleTime(Duration time)
time - that a connection has been idle and should be prunedCopyright © 2003-2019 Virginia Tech. All Rights Reserved.