cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: cvs commit: xml-cocoon/src/org/apache/cocoon/util ComponentPool.java
Date Thu, 01 Mar 2001 20:28:09 GMT
Davanum Srinivas wrote:
> 
> 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.  Don't be too excited.  I am going to have to revert back to your
code, and possibly make that the abstract pool.  This is frustrating,
and I don't have the time to make it work all the way.

I added in a method to the ObjectFactory so that it can handle proper
end-of-lifecycle events for Objects when no longer needed.

> 
> 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 <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
> >     */
> >   -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/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

Mime
View raw message