1 22 23 24 package com.mchange.v2.resourcepool; 25 26 import java.util.Timer ; 27 import com.mchange.v2.async.*; 28 29 53 public abstract class ResourcePoolFactory 54 { 55 final static ResourcePoolFactory SHARED_INSTANCE = new BasicResourcePoolFactory(); 58 59 final static int DEFAULT_NUM_TASK_THREADS = 3; 60 61 public static ResourcePoolFactory getSharedInstance() 62 throws ResourcePoolException 63 { return SHARED_INSTANCE; } 64 65 public static ResourcePoolFactory createInstance() 66 { return new BasicResourcePoolFactory(); } 67 68 public static ResourcePoolFactory createInstance( int num_task_threads ) 69 { return new BasicResourcePoolFactory( num_task_threads ); } 70 71 75 public static ResourcePoolFactory createInstance( AsynchronousRunner taskRunner, 76 RunnableQueue asyncEventQueue, 77 Timer cullTimer ) 78 { return new BasicResourcePoolFactory( taskRunner, asyncEventQueue, cullTimer ); } 79 80 public static ResourcePoolFactory createInstance( Queuable taskRunnerEventQueue, 81 Timer cullTimer ) 82 { 83 return createInstance( taskRunnerEventQueue, 84 taskRunnerEventQueue == null ? 85 null : 86 taskRunnerEventQueue.asRunnableQueue(), 87 cullTimer ); 88 } 89 90 public abstract void setMin( int min ) 91 throws ResourcePoolException; 92 93 public abstract int getMin() 94 throws ResourcePoolException; 95 96 public abstract void setMax( int max ) 97 throws ResourcePoolException; 98 99 public abstract int getStart() 100 throws ResourcePoolException; 101 102 public abstract void setStart( int start ) 103 throws ResourcePoolException; 104 105 public abstract int getMax() 106 throws ResourcePoolException; 107 108 public abstract void setIncrement( int max ) 109 throws ResourcePoolException; 110 111 public abstract int getIncrement() 112 throws ResourcePoolException; 113 114 public abstract void setAcquisitionRetryAttempts( int retry_attempts ) 115 throws ResourcePoolException; 116 117 public abstract int getAcquisitionRetryAttempts() 118 throws ResourcePoolException; 119 120 public abstract void setAcquisitionRetryDelay( int retry_delay ) 121 throws ResourcePoolException; 122 123 public abstract int getAcquisitionRetryDelay() 124 throws ResourcePoolException; 125 126 public abstract void setIdleResourceTestPeriod( long test_period ) 127 throws ResourcePoolException; 128 129 public abstract long getIdleResourceTestPeriod() 130 throws ResourcePoolException; 131 132 public abstract void setResourceMaxAge( long millis ) 133 throws ResourcePoolException; 134 135 public abstract long getResourceMaxAge() 136 throws ResourcePoolException; 137 138 public abstract void setResourceMaxIdleTime( long millis ) 139 throws ResourcePoolException; 140 141 public abstract long getResourceMaxIdleTime() 142 throws ResourcePoolException; 143 144 public abstract void setExcessResourceMaxIdleTime( long millis ) 145 throws ResourcePoolException; 146 147 public abstract long getExcessResourceMaxIdleTime() 148 throws ResourcePoolException; 149 150 public abstract long getDestroyOverdueResourceTime() 151 throws ResourcePoolException; 152 153 public abstract void setDestroyOverdueResourceTime( long millis ) 154 throws ResourcePoolException; 155 156 public abstract void setExpirationEnforcementDelay( long millis ) 157 throws ResourcePoolException; 158 159 public abstract long getExpirationEnforcementDelay() 160 throws ResourcePoolException; 161 162 public abstract void setBreakOnAcquisitionFailure( boolean b ) 163 throws ResourcePoolException; 164 165 public abstract boolean getBreakOnAcquisitionFailure() 166 throws ResourcePoolException; 167 168 public abstract void setDebugStoreCheckoutStackTrace( boolean debug_store_checkout_stacktrace ) 169 throws ResourcePoolException; 170 171 public abstract boolean getDebugStoreCheckoutStackTrace() 172 throws ResourcePoolException; 173 174 183 186 public abstract ResourcePool createPool(ResourcePool.Manager mgr) 187 throws ResourcePoolException; 188 } 189 190 | Popular Tags |