You can configure connections to be closed when they are idle. For example; if you just had a peak period and now want to reap the unused ones. This is done via the
Idle checking is done on a separate Idle Remover
thread on an 'least recently used' (LRU
Idle connections (connections that have been unused for the period defined by
idle-timeout-minutes) are purged regularly. The check is performed at an interval that is half of the
The pool itself operates on an 'most recently used' (MRU
) basis. This allows the excess connections to be easily identified.
Should closing idle connections cause the pool to fall below the
min-pool-size value, new connections are created.
If you have long-running transactions and you use interleaving (i.e. do not track-connection-by-tx) make sure the idle timeout is greater than the transaction timeout. When interleaving the connection is returned to the pool for others to use. If however nobody does use it, it would be a candidate for removal before the transaction is committed.