com.mchange.v2.resourcepool
Class ResourcePoolFactory

java.lang.Object
  extended by 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
ResourcePoolFactory()
           
 
Method Summary
static ResourcePoolFactory createInstance()
           
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(int num_task_threads)
           
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  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 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourcePoolFactory

public ResourcePoolFactory()
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

createPool

public abstract ResourcePool createPool(ResourcePool.Manager mgr)
                                 throws ResourcePoolException
Throws:
ResourcePoolException