Class BoundedPoolConfig.Builder

    • Constructor Detail

      • Builder

        protected Builder()
    • Method Detail

      • testOnAcquire

        public BoundedPoolConfig.Builder testOnAcquire​(boolean testOnAcquire)
        Description copied from class: BasePoolConfig.Builder
        Configures whether objects acquired from the pool will be validated before being returned from the acquire method. Validation is performed by the AsyncObjectFactory.validate(Object) method of the factory associated with the pool. If the object fails to validate, it will be removed from the pool and destroyed, and a new attempt will be made to borrow an object from the pool.
        Overrides:
        testOnAcquire in class BasePoolConfig.Builder
        Parameters:
        testOnAcquire - true if objects should be validated before being returned from the acquire method.
        Returns:
        this BasePoolConfig.Builder.
      • maxTotal

        public BoundedPoolConfig.Builder maxTotal​(int maxTotal)
        Configures the maximum number of objects that can be allocated by the pool (checked out to clients, or idle awaiting checkout) at a given time. When negative, there is no limit to the number of objects that can be managed by the pool at one time.
        Parameters:
        maxTotal - maximum number of objects that can be allocated by the pool.
        Returns:
        this BoundedPoolConfig.Builder.
      • maxIdle

        public BoundedPoolConfig.Builder maxIdle​(int maxIdle)
        Returns the cap on the number of "idle" instances in the pool. If maxIdle is set too low on heavily loaded systems it is possible you will see objects being destroyed and almost immediately new objects being created. This is a result of the active threads momentarily returning objects faster than they are requesting them, causing the number of idle objects to rise above maxIdle. The best value for maxIdle for heavily loaded system will vary but the default is a good starting point.
        Parameters:
        maxIdle - the cap on the number of "idle" instances in the pool.
        Returns:
        this BoundedPoolConfig.Builder.
      • minIdle

        public BoundedPoolConfig.Builder minIdle​(int minIdle)
        Configures the minimum number of idle objects to maintain in the pool. If this is the case, an attempt is made to ensure that the pool has the required minimum number of instances during idle object eviction runs.
        Parameters:
        minIdle - minimum number of idle objects to maintain in the pool.
        Returns:
        this BoundedPoolConfig.Builder.