Class AbstractPruneStrategy

java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.pool.AbstractPruneStrategy
All Implemented Interfaces:
Consumer<Supplier<Iterator<PooledConnectionProxy>>>, Freezable, PruneStrategy
Direct Known Subclasses:
AgePruneStrategy

public abstract class AbstractPruneStrategy extends AbstractFreezable implements PruneStrategy
Base class for prune strategy implementations.
  • Field Details

    • logger

      protected final Logger logger
      Logger for this class.
    • prunePeriod

      private Duration prunePeriod
      Prune period.
  • Constructor Details

    • AbstractPruneStrategy

      public AbstractPruneStrategy()
  • Method Details

    • getPrunePeriod

      public Duration getPrunePeriod()
      Description copied from interface: PruneStrategy
      Returns the interval at which the prune task will be executed.
      Specified by:
      getPrunePeriod in interface PruneStrategy
      Returns:
      prune period
    • setPrunePeriod

      public void setPrunePeriod(Duration period)
      Sets the prune period.
      Parameters:
      period - to set
    • accept

      public void accept(Supplier<Iterator<PooledConnectionProxy>> connections)
      Specified by:
      accept in interface Consumer<Supplier<Iterator<PooledConnectionProxy>>>
    • getPruneConditions

      protected abstract List<Predicate<PooledConnectionProxy>> getPruneConditions()
      Returns the predicates used by this prune strategy. Each predicate will be invoked for every connection to be pruned.
      Returns:
      List of predicates that are evaluated in order. Connections are removed from the pool immediately upon predicate returning true; subsequent predicates operate on a reduced pool.