cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject Re: cvs commit: xml-cocoon/src/org/apache/cocoon/util ComponentPool.java
Date Thu, 01 Mar 2001 20:23:22 GMT
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 <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/

Mime
View raw message