Options

Options

Source:
Properties:
Name Type Attributes Default Description
minSize number <optional>
0

The minimum number of objects the pool will try to maintain including borrowed objects. Cannot be greater than given maxSize. If this value is given without a maxSize, maxSize will be adjusted if needed

maxSize number <optional>
1

The maximum number of objects the pool can manage including objects being created. Cannot be less than given minSize. If this value is given without a minSize, minSize will be adjusted if needed

defaultTimeoutInMs number | null <optional>
30000

The default time in milliseconds calls to pool.acquire() and pool.use() will time out

maxPendingRequests number | null <optional>
null

The number of requests that can be queued if the pool is at maximum size and has no objects available. ie. the max number of requests waiting for an object to be returned. Note: Setting maxPendingRequests to null will disable maxPendingRequests which is different from setting it to 0 which not allow any requests to be queued when the pool does not have any objects available

idleCheckIntervalInMs number | null <optional>
null

The interval the pool checks for and removes idle objects

maxIdleToRemove number | null <optional>
null

The max objects that can be removed when the pool checks for idle objects

softIdleTimeInMs number | null <optional>
null

The amount of time an object must be idle before being eligible for soft removal. If an object is checked and exceeds this time it will be destroyed if the currently available objects is above the minimum

hardIdleTimeInMs number | null <optional>
30000

The amount of time an object must be idle before being eligible for hard removal. If an object is checked exceeding this idle time it will be destroyed. If destroying the object would bring the pool below the minimum, a new object will be created

shouldAutoStart boolean <optional>
true

If true, pool will start automatically. If a minSize is set the pool will start creating objects before any requests are made

shouldValidateOnDispatch boolean <optional>
false

If true, pool will call factory.validate() on objects before dispatching them for use. If validation fails the invalid object will be destroyed and the pool will attempt to dispatch another pooled object, creating one if required

shouldValidateOnReturn boolean <optional>
false

If true, pool will call factory.validate() on objects before adding them back to the available objects. If validation fails, the invalid object will be destroyed. If destroying the object would bring the pool below the minimum, a new object will be created.

shouldUseFifo boolean <optional>
true

Determines the order objects are dispatched. Either First in, First out (FIFO) or Last in, First out (LIFO). By default, the pool dispatches the object that has been available the longest, working like a queue (FIFO). Setting this option to false will dispatch the most recently returned or created object, working like a stack (LIFO)