1 23 24 29 30 31 package com.sun.ejb.containers.util.pool; 32 33 import java.util.Collection ; 34 import java.util.ArrayList ; 35 import java.util.logging.*; 36 37 import com.sun.logging.*; 38 39 54 public class BoundedPool 55 extends AbstractPool 56 { 57 58 private static Logger _logger; 59 static{ 60 _logger=LogDomains.getLogger(LogDomains.EJB_LOGGER); 61 } 62 63 protected int previousSize = 0; 64 65 public BoundedPool(ObjectFactory factory, int steadyPoolSize, 66 int resizeQuantity, int maxPoolsize, long maxWaitTimeInMillis, 67 int idleTimeoutInSeconds, ClassLoader loader) 68 { 69 super(factory, steadyPoolSize, resizeQuantity, maxPoolsize, 70 maxWaitTimeInMillis, idleTimeoutInSeconds, loader); 71 super.poolName="BoundedPool"; 72 } 73 74 protected void removeIdleObjects() { 75 int curSize = 0; 76 int count = 0; 77 synchronized (list) { 78 curSize = list.size(); 79 } 80 81 if(curSize <= steadyPoolSize) 82 return; count = (curSize > (steadyPoolSize + resizeQuantity) ) ? 84 resizeQuantity: (curSize - steadyPoolSize); 85 previousSize = curSize; 86 87 if (count > 0) { 88 _logger.log(Level.FINE, 89 "BoundedPool removing " + count + " objects"); 90 super.remove(count); 91 } 92 } 93 94 } 95 | Popular Tags |