Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • maxActive controls the maximum number of objects that can be borrowed from the pool at one time. When non-positive, there is no limit to the number of objects that may be active at one time. When maxActive is exceeded, the pool is said to be exhausted. If 'whenExhaustedAction' is 'grow' this value is not used.
  • maxIdle controls the maximum number of objects that can sit idle in the pool at any time. When negative, there is no limit to the number of objects that may be idle at one time.
  • whenExhaustedAction specifies the behavior when the pool is exhausted:
    • When whenExhaustedAction is 'fail', pool will throw an Exception.
    • When whenExhaustedAction is 'grow', pool will create a new object and return it(, essentially making maxActive meaningless.)
    • When whenExhaustedAction is 'block', pool will block (invoke Object. wait until a new or idle object is available. If a  If a positive maxWait value is supplied, the pool will block for at most that many milliseconds, after which an Exception will be thrown. If maxWait is non-positive, the server method will block indefinitely. You should always set a positive maxWait value if you use 'block'.
  • When testOnBorrow is set, the pool will attempt to validate each object before it is returned from the pool. Objects that fail to validate will be dropped from the pool, and a different object will be borrowed.
  • When testOnReturn is set, the pool will attempt to validate each object before it is returned to the pool. Objects that fail to validate will be dropped from the pool.
    Optionally, one may configure the pool to examine and possibly evict objects as they sit idle in the pool. This is performed by an "idle object eviction" thread, which runs asychronously. The idle object eviction thread may be configured using the following attributes:
  • timeBetweenEvictionRunsMillis indicates how long the eviction thread should sleep before "runs" of examining idle objects. When non-positive, no eviction thread will be launched.
  • minEvictableIdleTimeMillis specifies the minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due to idle time. When non-positive, no object will be dropped from the pool due to idle time alone.
  • testWhileIdle indicates whether or not idle objects should be validated. Objects that fail to validate will be dropped from the pool.

...

Code Block
xml
xml
linenumberstrue

<pool:pool>
    <minIdle>4</minIdle>
    <maxIdle>8</maxIdle>
    <testOnBorrow>true</testOnBorrow>
    <testOnReturn>false</testOnReturn>
    <testWhileIdle>true</testWhileIdle>
    <timeBetweenEvictionRunsMillis>60000</timeBetweenEvictionRunsMillis>
    <minEvictableIdleTimeMillis>300000</minEvictableIdleTimeMillis>
    <whenExhaustedAction>grow</whenExhaustedAction>
</pool:pool>