Class IdlePruneStrategy

  • All Implemented Interfaces:
    Consumer<Supplier<Iterator<PooledConnectionProxy>>>, Freezable, PruneStrategy

    public class IdlePruneStrategy
    extends AgePruneStrategy
    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. This strategy will not prune available connections below the minimum pool size unless an age time is configured. Connections will be pruned by age before they are pruned by idle time.
    • Field Detail

      • DEFAULT_IDLE_TIME

        private static final Duration DEFAULT_IDLE_TIME
        Default idle time. Value is 10 minutes.
      • 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.
        Parameters:
        idle - time at which a connection should be pruned
      • IdlePruneStrategy

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

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