Return-Path: Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 64990 invoked from network); 1 Mar 2001 20:23:20 -0000 Received: from web111.mail.yahoo.com (HELO web111.yahoomail.com) (205.180.60.81) by h31.sny.collab.net with SMTP; 1 Mar 2001 20:23:20 -0000 Received: (qmail 1664 invoked by uid 60001); 1 Mar 2001 20:23:22 -0000 Message-ID: <20010301202322.1663.qmail@web111.yahoomail.com> Received: from [141.202.248.55] by web111.yahoomail.com; Thu, 01 Mar 2001 12:23:22 PST Date: Thu, 1 Mar 2001 12:23:22 -0800 (PST) From: Davanum Srinivas Reply-To: dims@yahoo.com Subject: Re: cvs commit: xml-cocoon/src/org/apache/cocoon/util ComponentPool.java To: cocoon-dev@xml.apache.org In-Reply-To: <20010301201225.47985.qmail@apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Berin, Do you need to check in a new AvalonAPI.JAR? The one currently in CVS was checked in on "2001/2/22 15:3:08" Thanks, dims --- bloritsch@apache.org wrote: > bloritsch 01/03/01 12:12:24 > > Modified: src/org/apache/cocoon/util Tag: xml-cocoon2 > ComponentPool.java > Log: > Added more pool instances. I need to figure out why the pool isn't > creating more instances... > > Revision Changes Path > No revision > > > No revision > > > 1.1.2.12 +32 -2 xml-cocoon/src/org/apache/cocoon/util/Attic/ComponentPool.java > > Index: ComponentPool.java > =================================================================== > RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/ComponentPool.java,v > retrieving revision 1.1.2.11 > retrieving revision 1.1.2.12 > diff -u -r1.1.2.11 -r1.1.2.12 > --- ComponentPool.java 2001/03/01 19:29:05 1.1.2.11 > +++ ComponentPool.java 2001/03/01 20:12:23 1.1.2.12 > @@ -12,6 +12,7 @@ > import org.apache.avalon.util.pool.ThreadSafePool; > import org.apache.avalon.util.pool.ObjectFactory; > import org.apache.avalon.util.pool.PoolController; > +import org.apache.avalon.util.pool.Resizable; > import org.apache.cocoon.ComponentFactory; > > /** > @@ -20,9 +21,9 @@ > * > * @author Giacomo Pati > */ > -public class ComponentPool extends ThreadSafePool { > +public class ComponentPool extends ThreadSafePool implements Resizable { > > - public final static int DEFAULT_POOL_SIZE = 8; > + public final static int DEFAULT_POOL_SIZE = 16; > > public ComponentPool(final ObjectFactory factory) throws Exception { > super(factory, DEFAULT_POOL_SIZE/2, DEFAULT_POOL_SIZE); > @@ -37,5 +38,34 @@ > final int initial, > final int maximum) throws Exception { > super(factory, initial, maximum); > + } > + > + public synchronized void grow(int amount) { > + if (m_currentCount >= m_max) { > + m_max += amount; > + } else { > + m_max = Math.max(m_currentCount + amount, m_max); > + } > + > + while (m_currentCount < m_max) { > + try { > + m_ready.add( m_factory.newInstance() ); > + m_currentCount++; > + } catch (Exception e) { > + getLogger().debug("Error growing the pool", e); > + } > + } > + > + notify(); > + } > + > + public synchronized void shrink(int amount) { > + m_max -= amount; > + > + while (m_currentCount > m_max) { > + m_ready.remove(0); > + } > + > + notify(); > } > } > > > > > ---------------------------------------------------------------------- > In case of troubles, e-mail: webmaster@xml.apache.org > To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org > For additional commands, e-mail: cocoon-cvs-help@xml.apache.org > ===== Davanum Srinivas, JNI-FAQ Manager http://www.jGuru.com/faq/JNI __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/