Package com.mchange.v2.resourcepool
Class ResourcePoolFactory
java.lang.Object
com.mchange.v2.resourcepool.ResourcePoolFactory
- Direct Known Subclasses:
BasicResourcePoolFactory
A Factory for ResourcePools. ResourcePoolFactories may manage resources (usually threads that perform maintenance tasks) that are shared by all pools that they create. Clients who require a large number of pools may wish to create their own factory instances rather than using the shared instance to control the degree of resource (Thread) sharing among pools.
Factories should (and the default implementation does) be careful to ensure that factories keep resources open only while there are active ResourcePools that they have created.
Subclasses must mark all methods synchronized so that clients may reliably use shared factories to do stuff like...
synchronized (factory) { factory.setMin(8); factory.setMax(24); ResourcePool rp = factory.createPool(); }
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourcePoolFactory
static ResourcePoolFactory
createInstance
(int num_task_threads) static ResourcePoolFactory
createInstance
(com.mchange.v2.async.AsynchronousRunner taskRunner, com.mchange.v2.async.RunnableQueue asyncEventQueue, Timer cullTimer) Any or all of these arguments can be null -- any unspecified resources will be created and cleaned up internally.static ResourcePoolFactory
createInstance
(com.mchange.v2.async.Queuable taskRunnerEventQueue, Timer cullTimer) abstract ResourcePool
abstract int
abstract int
abstract boolean
abstract boolean
abstract long
abstract long
abstract long
abstract boolean
abstract long
abstract int
abstract int
getMax()
abstract int
getMin()
abstract long
abstract long
static ResourcePoolFactory
abstract int
getStart()
abstract void
setAcquisitionRetryAttempts
(int retry_attempts) abstract void
setAcquisitionRetryDelay
(int retry_delay) abstract void
setBreakOnAcquisitionFailure
(boolean b) abstract void
setDebugStoreCheckoutStackTrace
(boolean debug_store_checkout_stacktrace) abstract void
setDestroyOverdueResourceTime
(long millis) abstract void
setExcessResourceMaxIdleTime
(long millis) abstract void
setExpirationEnforcementDelay
(long millis) abstract void
setForceSynchronousCheckins
(boolean force_synchronous_checkins) abstract void
setIdleResourceTestPeriod
(long test_period) abstract void
setIncrement
(int max) abstract void
setMax
(int max) abstract void
setMin
(int min) abstract void
setResourceMaxAge
(long millis) abstract void
setResourceMaxIdleTime
(long millis) abstract void
setStart
(int start)
-
Constructor Details
-
ResourcePoolFactory
public ResourcePoolFactory()
-
-
Method Details
-
createInstance
-
createInstance
-
createInstance
public static ResourcePoolFactory createInstance(com.mchange.v2.async.AsynchronousRunner taskRunner, com.mchange.v2.async.RunnableQueue asyncEventQueue, Timer cullTimer) Any or all of these arguments can be null -- any unspecified resources will be created and cleaned up internally. -
createInstance
public static ResourcePoolFactory createInstance(com.mchange.v2.async.Queuable taskRunnerEventQueue, Timer cullTimer) -
setMin
- Throws:
ResourcePoolException
-
getMin
- Throws:
ResourcePoolException
-
setMax
- Throws:
ResourcePoolException
-
getStart
- Throws:
ResourcePoolException
-
setStart
- Throws:
ResourcePoolException
-
getMax
- Throws:
ResourcePoolException
-
setIncrement
- Throws:
ResourcePoolException
-
getIncrement
- Throws:
ResourcePoolException
-
setAcquisitionRetryAttempts
- Throws:
ResourcePoolException
-
getAcquisitionRetryAttempts
- Throws:
ResourcePoolException
-
setAcquisitionRetryDelay
- Throws:
ResourcePoolException
-
getAcquisitionRetryDelay
- Throws:
ResourcePoolException
-
setIdleResourceTestPeriod
- Throws:
ResourcePoolException
-
getIdleResourceTestPeriod
- Throws:
ResourcePoolException
-
setResourceMaxAge
- Throws:
ResourcePoolException
-
getResourceMaxAge
- Throws:
ResourcePoolException
-
setResourceMaxIdleTime
- Throws:
ResourcePoolException
-
getResourceMaxIdleTime
- Throws:
ResourcePoolException
-
setExcessResourceMaxIdleTime
- Throws:
ResourcePoolException
-
getExcessResourceMaxIdleTime
- Throws:
ResourcePoolException
-
getDestroyOverdueResourceTime
- Throws:
ResourcePoolException
-
setDestroyOverdueResourceTime
- Throws:
ResourcePoolException
-
setExpirationEnforcementDelay
- Throws:
ResourcePoolException
-
getExpirationEnforcementDelay
- Throws:
ResourcePoolException
-
setBreakOnAcquisitionFailure
- Throws:
ResourcePoolException
-
getBreakOnAcquisitionFailure
- Throws:
ResourcePoolException
-
setDebugStoreCheckoutStackTrace
public abstract void setDebugStoreCheckoutStackTrace(boolean debug_store_checkout_stacktrace) throws ResourcePoolException - Throws:
ResourcePoolException
-
getDebugStoreCheckoutStackTrace
- Throws:
ResourcePoolException
-
setForceSynchronousCheckins
public abstract void setForceSynchronousCheckins(boolean force_synchronous_checkins) throws ResourcePoolException - Throws:
ResourcePoolException
-
getForceSynchronousCheckins
- Throws:
ResourcePoolException
-
createPool
- Throws:
ResourcePoolException