Package com.mchange.v2.resourcepool
Class ResourcePoolFactory
- java.lang.Object
-
- com.mchange.v2.resourcepool.ResourcePoolFactory
-
- Direct Known Subclasses:
BasicResourcePoolFactory
public abstract class ResourcePoolFactory extends java.lang.Object
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 Constructor Description ResourcePoolFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ResourcePoolFactory
createInstance()
static ResourcePoolFactory
createInstance(int num_task_threads)
static ResourcePoolFactory
createInstance(com.mchange.v2.async.AsynchronousRunner taskRunner, com.mchange.v2.async.RunnableQueue asyncEventQueue, java.util.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, java.util.Timer cullTimer)
abstract ResourcePool
createPool(ResourcePool.Manager mgr)
abstract int
getAcquisitionRetryAttempts()
abstract int
getAcquisitionRetryDelay()
abstract boolean
getBreakOnAcquisitionFailure()
abstract boolean
getDebugStoreCheckoutStackTrace()
abstract long
getDestroyOverdueResourceTime()
abstract long
getExcessResourceMaxIdleTime()
abstract long
getExpirationEnforcementDelay()
abstract boolean
getForceSynchronousCheckins()
abstract long
getIdleResourceTestPeriod()
abstract int
getIncrement()
abstract int
getMax()
abstract int
getMin()
abstract long
getResourceMaxAge()
abstract long
getResourceMaxIdleTime()
static ResourcePoolFactory
getSharedInstance()
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)
-
-
-
Method Detail
-
getSharedInstance
public static ResourcePoolFactory getSharedInstance() throws ResourcePoolException
- Throws:
ResourcePoolException
-
createInstance
public static ResourcePoolFactory createInstance()
-
createInstance
public static ResourcePoolFactory createInstance(int num_task_threads)
-
createInstance
public static ResourcePoolFactory createInstance(com.mchange.v2.async.AsynchronousRunner taskRunner, com.mchange.v2.async.RunnableQueue asyncEventQueue, java.util.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, java.util.Timer cullTimer)
-
setMin
public abstract void setMin(int min) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getMin
public abstract int getMin() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setMax
public abstract void setMax(int max) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getStart
public abstract int getStart() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setStart
public abstract void setStart(int start) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getMax
public abstract int getMax() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setIncrement
public abstract void setIncrement(int max) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getIncrement
public abstract int getIncrement() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setAcquisitionRetryAttempts
public abstract void setAcquisitionRetryAttempts(int retry_attempts) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getAcquisitionRetryAttempts
public abstract int getAcquisitionRetryAttempts() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setAcquisitionRetryDelay
public abstract void setAcquisitionRetryDelay(int retry_delay) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getAcquisitionRetryDelay
public abstract int getAcquisitionRetryDelay() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setIdleResourceTestPeriod
public abstract void setIdleResourceTestPeriod(long test_period) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getIdleResourceTestPeriod
public abstract long getIdleResourceTestPeriod() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setResourceMaxAge
public abstract void setResourceMaxAge(long millis) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getResourceMaxAge
public abstract long getResourceMaxAge() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setResourceMaxIdleTime
public abstract void setResourceMaxIdleTime(long millis) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getResourceMaxIdleTime
public abstract long getResourceMaxIdleTime() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setExcessResourceMaxIdleTime
public abstract void setExcessResourceMaxIdleTime(long millis) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getExcessResourceMaxIdleTime
public abstract long getExcessResourceMaxIdleTime() throws ResourcePoolException
- Throws:
ResourcePoolException
-
getDestroyOverdueResourceTime
public abstract long getDestroyOverdueResourceTime() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setDestroyOverdueResourceTime
public abstract void setDestroyOverdueResourceTime(long millis) throws ResourcePoolException
- Throws:
ResourcePoolException
-
setExpirationEnforcementDelay
public abstract void setExpirationEnforcementDelay(long millis) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getExpirationEnforcementDelay
public abstract long getExpirationEnforcementDelay() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setBreakOnAcquisitionFailure
public abstract void setBreakOnAcquisitionFailure(boolean b) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getBreakOnAcquisitionFailure
public abstract boolean getBreakOnAcquisitionFailure() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setDebugStoreCheckoutStackTrace
public abstract void setDebugStoreCheckoutStackTrace(boolean debug_store_checkout_stacktrace) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getDebugStoreCheckoutStackTrace
public abstract boolean getDebugStoreCheckoutStackTrace() throws ResourcePoolException
- Throws:
ResourcePoolException
-
setForceSynchronousCheckins
public abstract void setForceSynchronousCheckins(boolean force_synchronous_checkins) throws ResourcePoolException
- Throws:
ResourcePoolException
-
getForceSynchronousCheckins
public abstract boolean getForceSynchronousCheckins() throws ResourcePoolException
- Throws:
ResourcePoolException
-
createPool
public abstract ResourcePool createPool(ResourcePool.Manager mgr) throws ResourcePoolException
- Throws:
ResourcePoolException
-
-