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 ResourcePoolFactorystatic ResourcePoolFactorycreateInstance(int num_task_threads) static ResourcePoolFactorycreateInstance(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 ResourcePoolFactorycreateInstance(com.mchange.v2.async.Queuable taskRunnerEventQueue, Timer cullTimer) abstract ResourcePoolabstract intabstract intabstract booleanabstract booleanabstract longabstract longabstract longabstract booleanabstract longabstract intabstract intgetMax()abstract intgetMin()abstract longabstract longstatic ResourcePoolFactoryabstract intgetStart()abstract voidsetAcquisitionRetryAttempts(int retry_attempts) abstract voidsetAcquisitionRetryDelay(int retry_delay) abstract voidsetBreakOnAcquisitionFailure(boolean b) abstract voidsetDebugStoreCheckoutStackTrace(boolean debug_store_checkout_stacktrace) abstract voidsetDestroyOverdueResourceTime(long millis) abstract voidsetExcessResourceMaxIdleTime(long millis) abstract voidsetExpirationEnforcementDelay(long millis) abstract voidsetForceSynchronousCheckins(boolean force_synchronous_checkins) abstract voidsetIdleResourceTestPeriod(long test_period) abstract voidsetIncrement(int max) abstract voidsetMax(int max) abstract voidsetMin(int min) abstract voidsetResourceMaxAge(long millis) abstract voidsetResourceMaxIdleTime(long millis) abstract voidsetStart(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