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();
}
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourcePoolFactory
public ResourcePoolFactory()
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
createPool
public abstract ResourcePool createPool(ResourcePool.Manager mgr)
throws ResourcePoolException
- Throws:
ResourcePoolException