Class IdlePruneStrategy

  • All Implemented Interfaces:
    Function<PooledConnectionProxy,​Boolean>, 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.
    • Field Detail


        private static final int DEFAULT_STATISTICS_SIZE
        Default number of statistics to store. Value is 1.
        See Also:
        Constant Field Values

        private static final Duration DEFAULT_PRUNE_PERIOD
        Default prune period in seconds. Value is 5 minutes.

        private static final Duration DEFAULT_IDLE_TIME
        Default idle time. Value is 10 minutes.
      • logger

        protected final Logger logger
        Logger for this class.
      • prunePeriod

        private Duration prunePeriod
        Prune period.
      • idleTime

        private Duration idleTime
        Idle time.
    • Constructor Detail

      • IdlePruneStrategy

        public IdlePruneStrategy()
        Creates a new idle prune strategy.
      • IdlePruneStrategy

        public IdlePruneStrategy​(Duration idle)
        Creates a new idle prune strategy. Sets the prune period to half of the supplied idle time.
        idle - time at which a connection should be pruned
      • IdlePruneStrategy

        public IdlePruneStrategy​(Duration period,
                                 Duration idle)
        Creates a new idle prune strategy.
        period - to execute the prune task
        idle - time at which a connection should be pruned