prussell    00/12/10 13:21:16

  Modified:    src/org/apache/cocoon/util Tag: xml-cocoon2
                        ComponentPool.java
  Log:
  Added logging to ComponentPool to make it easier to track down components
  which aren't being returned.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +17 -1     
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ComponentPool.java        2000/10/13 04:05:40     1.1.2.1
  +++ ComponentPool.java        2000/12/10 21:21:16     1.1.2.2
  @@ -13,6 +13,9 @@
   import org.apache.avalon.util.pool.ObjectFactory;
   import org.apache.avalon.util.pool.PoolController;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /**
    * This is a implementation of <code>Pool</code> for SitemapComponents
    * that is thread safe.
  @@ -23,6 +26,8 @@
   
       public final static int DEFAULT_POOL_SIZE = 16;
   
  +    private Logger log = LogKit.getLoggerFor("cocoon");
  +
       public ComponentPool(final ObjectFactory factory,
                            final PoolController controller) throws Exception {
           super(factory, controller, DEFAULT_POOL_SIZE/2, DEFAULT_POOL_SIZE);
  @@ -48,7 +53,13 @@
        */
       public final Poolable get() throws Exception {
           synchronized(m_pool) {
  -            return super.get();
  +                     Poolable component = super.get();
  +                     log.debug(
  +                             "ComponentPool retrieved " 
  +                             + component.getClass().getName() 
  +                             + " (" + component.toString() + ")"
  +                     );
  +            return component;
           }
       }
   
  @@ -60,6 +71,11 @@
       public final void put(final Poolable poolable) {
           synchronized(m_pool) {
               super.put(poolable);
  +                     log.debug(
  +                             "ComponentPool returned "
  +                             + poolable.getClass().getName()
  +                             + " (" + poolable.toString() + ")"
  +                     );
           }
       }
   }
  
  
  

Reply via email to