1 22 23 24 package com.mchange.v2.resourcepool; 25 26 import com.mchange.v1.util.ClosableResource; 27 28 public interface ResourcePool extends ClosableResource 29 { 30 final static int KNOWN_AND_AVAILABLE = 0; 32 final static int KNOWN_AND_CHECKED_OUT = 1; 33 final static int UNKNOWN_OR_PURGED = -1; 34 35 public Object checkoutResource() 36 throws ResourcePoolException, InterruptedException ; 37 38 public Object checkoutResource( long timeout ) 39 throws TimeoutException, ResourcePoolException, InterruptedException ; 40 41 public void checkinResource( Object resc ) 42 throws ResourcePoolException; 43 44 public void checkinAll() 45 throws ResourcePoolException; 46 47 public int statusInPool( Object resc ) 48 throws ResourcePoolException; 49 50 55 public void markBroken( Object resc ) 56 throws ResourcePoolException; 57 58 public int getMinPoolSize() 59 throws ResourcePoolException; 60 61 public int getMaxPoolSize() 62 throws ResourcePoolException; 63 64 public int getPoolSize() 65 throws ResourcePoolException; 66 67 public void setPoolSize(int size) 68 throws ResourcePoolException; 69 70 public int getAvailableCount() 71 throws ResourcePoolException; 72 73 public int getExcludedCount() 74 throws ResourcePoolException; 75 76 public int getAwaitingCheckinCount() 77 throws ResourcePoolException; 78 79 public long getEffectiveExpirationEnforcementDelay() 80 throws ResourcePoolException; 81 82 public long getStartTime() 83 throws ResourcePoolException; 84 85 public long getUpTime() 86 throws ResourcePoolException; 87 88 public long getNumFailedCheckins() 89 throws ResourcePoolException; 90 91 public long getNumFailedCheckouts() 92 throws ResourcePoolException; 93 94 public long getNumFailedIdleTests() 95 throws ResourcePoolException; 96 97 public int getNumCheckoutWaiters() 98 throws ResourcePoolException; 99 100 public Throwable getLastAcquisitionFailure() 101 throws ResourcePoolException; 102 103 public Throwable getLastCheckinFailure() 104 throws ResourcePoolException; 105 106 public Throwable getLastCheckoutFailure() 107 throws ResourcePoolException; 108 109 public Throwable getLastIdleCheckFailure() 110 throws ResourcePoolException; 111 112 public Throwable getLastResourceTestFailure() 113 throws ResourcePoolException; 114 115 116 117 124 public void resetPool() 125 throws ResourcePoolException; 126 127 public void close() 128 throws ResourcePoolException; 129 130 public void close( boolean close_checked_out_resources ) 131 throws ResourcePoolException; 132 133 public interface Manager 134 { 135 public Object acquireResource() throws Exception ; 136 public void refurbishIdleResource(Object resc) throws Exception ; 137 public void refurbishResourceOnCheckout(Object resc) throws Exception ; 138 public void refurbishResourceOnCheckin(Object resc) throws Exception ; 139 public void destroyResource(Object resc) throws Exception ; 140 } 141 } 142 | Popular Tags |