directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 6769 - in incubator/directory/eve/trunk/eve/frontend/buffer: merlin-impl merlin-impl/src/java/org/apache/eve/buffer merlin-impl/src/test merlin-impl/src/test/org merlin-impl/src/test/org/apache merlin-impl/src/test/org/apache/eve merlin-impl/src/test/org/apache/eve/buffer pojo-impl pojo-impl/src/java/org/apache/eve/buffer pojo-impl/src/test pojo-impl/src/test/org pojo-impl/src/test/org/apache pojo-impl/src/test/org/apache/eve pojo-impl/src/test/org/apache/eve/buffer spi/src/java/org/apache/eve/buffer
Date Thu, 19 Feb 2004 07:53:00 GMT
Author: akarasulu
Date: Wed Feb 18 23:52:59 2004
New Revision: 6769

Added:
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/AvalonLoggingMonitor.java
      - copied, changed from rev 6662, incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/test/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/test/org/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/test/org/apache/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/test/org/apache/eve/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/test/org/apache/eve/buffer/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/test/org/apache/eve/buffer/MerlinBufferPoolTest.java
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/test/
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/test/org/
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/test/org/apache/
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/test/org/apache/eve/
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/test/org/apache/eve/buffer/
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/test/org/apache/eve/buffer/DefaultBufferPoolTest.java
   incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConsoleLogger.java
Removed:
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java
Modified:
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.properties
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.xml
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/project.properties
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/project.xml
   incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/java/org/apache/eve/buffer/DefaultBufferPool.java
   incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPool.java
   incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConfig.java
   incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitor.java
   incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitorAdapter.java
   incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/DefaultBufferPoolConfig.java
Log:
Fixed the buffer pool to not hash buffers anymore and all seems to work
well. Also added a console loging monitor and more methods to the service
of the bp so you can get more information about how many interested 
parties exist for a buffer and more.


Modified: incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.properties
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.properties	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.properties	Wed Feb 18 23:52:59 2004
@@ -1,3 +1,5 @@
 maven.xdoc.date=left
 maven.xdoc.version=${pom.currentVersion}
 merlin.debug=true
+merlin.info=true
+merlin.override=conf/config.xml

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.xml
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.xml	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.xml	Wed Feb 18 23:52:59 2004
@@ -24,6 +24,20 @@
     </description>
 
     <dependencies>
+      
+        <dependency>
+          <groupId>merlin</groupId>
+          <artifactId>merlin-unit</artifactId>
+          <version>3.2.9</version>
+        </dependency>
+      
+        <dependency>
+          <groupId>commons-lang</groupId>
+          <artifactId>commons-lang</artifactId>
+          <version>2.0</version>
+          <url>http://jakarta.apache.org/commons/lang</url>
+        </dependency>
+      
         <dependency>
             <groupId>avalon-framework</groupId>
             <artifactId>avalon-framework-api</artifactId>

Copied: incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/AvalonLoggingMonitor.java (from rev 6662, incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java)
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/AvalonLoggingMonitor.java	Wed Feb 18 23:52:59 2004
@@ -47,20 +47,24 @@
  Apache Software Foundation, please see <http://www.apache.org/>.
 
 */
-package org.apache.eve.buffer;
+package org.apache.eve.buffer ;
 
-import java.nio.ByteBuffer;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import java.nio.ByteBuffer ;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled ;
+import org.apache.commons.lang.ClassUtils;
+
 
 /**
- * $todo$ doc me
+ * A monitor that is a Avalon LogEnabled and reports events on behalf of the
+ * BufferPool component. 
  *
  * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
  * @author $Author: akarasulu $
  * @version $Rev: 6444 $
  */
-public class MerlinBufferPoolMonitor
+public class AvalonLoggingMonitor
     extends AbstractLogEnabled
     implements BufferPoolMonitor
 {
@@ -70,6 +74,15 @@
      */
     public void augmented( BufferPool a_bp )
     {
+        if ( getLogger().isDebugEnabled() )
+        {
+            getLogger().debug( a_bp + " grew by and increment of "
+                    + a_bp.getConfig().getIncrement() + " to a size of " 
+                    + a_bp.size() + " buffers total!" ) ;
+            getLogger().debug( a_bp + " currently has " + a_bp.getFreeCount()
+                    + " buffers free with " + a_bp.getInUseCount() 
+                    + " buffers in use." ) ;
+        }
     }
 
     
@@ -80,6 +93,16 @@
     public void bufferTaken( BufferPool a_bp, ByteBuffer a_buffer,
         Object a_taker )
     {
+        if ( getLogger().isDebugEnabled() )
+        {    
+            getLogger().debug( a_bp + " had a buffer taken by " 
+                    + getName( a_taker ) ) ;
+            getLogger().debug( a_bp + " currently has " + a_bp.getFreeCount()
+                    + " buffers free with " + a_bp.getInUseCount() 
+                    + " buffers in use." ) ;
+            getLogger().debug( "taken buffer has an interested party count of " 
+                    + a_bp.getInterestedCount( a_buffer ) ) ;
+        }
     }
 
     
@@ -90,6 +113,16 @@
     public void bufferReleased( BufferPool a_bp, ByteBuffer a_buffer,
         Object a_releaser )
     {
+        if ( getLogger().isDebugEnabled() )
+        {    
+            getLogger().debug( a_bp + " had buffer released by " 
+                    + getName( a_releaser ) ) ;
+            getLogger().debug( a_bp + " currently has " + a_bp.getFreeCount()
+                    + " buffers free with " + a_bp.getInUseCount() 
+                    + " buffers in use." ) ;
+            getLogger().debug( "taken buffer has an interested party count of " 
+                    + a_bp.getInterestedCount( a_buffer ) ) ;
+        }
     }
 
     
@@ -100,6 +133,16 @@
     public void interestClaimed( BufferPool a_bp, ByteBuffer a_buffer,
         Object a_claimer )
     {
+        if ( getLogger().isDebugEnabled() )
+        {    
+            getLogger().debug( getName( a_claimer ) 
+                    + " claimed interest on a buffer from " + a_bp ) ;
+            getLogger().debug( a_bp + " currently has " + a_bp.getFreeCount()
+                    + " buffers free with " + a_bp.getInUseCount() 
+                    + " buffers in use." ) ;
+            getLogger().debug( "taken buffer has an interested party count of " 
+                    + a_bp.getInterestedCount( a_buffer ) ) ;
+        }
     }
     
 
@@ -110,8 +153,19 @@
     public void interestReleased( BufferPool a_bp, ByteBuffer a_buffer,
                                   Object a_releaser )
     {
+        if ( getLogger().isDebugEnabled() )
+        {    
+            getLogger().debug( getName( a_releaser ) 
+                    + " released interest on a buffer from " + a_bp ) ;
+            getLogger().debug( a_bp + " currently has " + a_bp.getFreeCount()
+                    + " buffers free with " + a_bp.getInUseCount() 
+                    + " buffers in use." ) ;
+            getLogger().debug( "taken buffer has an interested party count of " 
+                    + a_bp.getInterestedCount( a_buffer ) ) ;
+        }
     }
 
+
     /*
      * (non-Javadoc)
      * @see org.apache.eve.buffer.BufferPoolMonitor#resourceUnavailable(
@@ -119,8 +173,15 @@
      */
     public void resourceUnavailable( BufferPool a_bp, Object a_party ) 
     {
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( getName( a_party ) 
+                    + " tried to get a buffer from " 
+                    + a_bp + " but no free resourses were available." ) ;
+        }
     }
 
+    
     /*
      * (non-Javadoc)
      * @see org.apache.eve.buffer.BufferPoolMonitor#unregisteredParty(
@@ -129,7 +190,13 @@
     public void unregisteredParty( BufferPool a_bp, ByteBuffer a_buffer, 
                                    Object a_party ) 
     {
+        if ( getLogger().isDebugEnabled() )
+        {    
+            getLogger().debug( getName( a_party ) 
+                    + " never claimed interest on a buffer from " + a_bp ) ;
+        }
     }
+
     
     /*
      * (non-Javadoc)
@@ -139,5 +206,33 @@
     public void nonPooledBuffer( BufferPool a_bp, ByteBuffer a_buffer, 
                                  Object a_party )
     {
+        if ( getLogger().isDebugEnabled() )
+        {    
+            getLogger().debug( getName( a_party ) 
+                    + " tried to claim or release interest for a buffer from " 
+                    + a_bp ) ;
+        }
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#releaseOfUnclaimed(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void releaseOfUnclaimed( BufferPool a_bp, ByteBuffer a_buffer, 
+                                    Object a_releaser )
+    {
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( getName( a_releaser ) 
+                    + " that never claimed interest on "
+                    + "a buffer tried to release claim to it from " + a_bp ) ;
+        }
+    }
+    
+    
+    public String getName( Object a_obj )
+    {
+        return ClassUtils.getShortClassName( a_obj.getClass() ) ;
     }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java	Wed Feb 18 23:52:59 2004
@@ -79,6 +79,8 @@
     private DefaultBufferPool m_bp = null ;
     /** the configuration bean for this BufferPool */
     private BufferPoolConfig m_config = null ;
+    /** the monitor for the BufferPool */
+    private AvalonLoggingMonitor m_monitor = new AvalonLoggingMonitor() ;
     
     
     // ------------------------------------------------------------------------
@@ -124,6 +126,51 @@
     }
     
     
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#size()
+     */
+    public int size()
+    {
+        return m_bp.size() ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getName()
+     */
+    public String getName()
+    {
+        return m_bp.getName() ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getInUseCount()
+     */
+    public int getInUseCount()
+    {
+        return m_bp.getInUseCount() ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getFreeCount()
+     */
+    public int getFreeCount()
+    {
+        return m_bp.getFreeCount() ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getInterestedCount(java.nio.ByteBuffer)
+     */
+    public int getInterestedCount(ByteBuffer a_buffer)
+    {
+        return m_bp.getInterestedCount( a_buffer ) ;
+    }
+    
+    
     // ------------------------------------------------------------------------
     // Avalon Life Cycle Methods
     // ------------------------------------------------------------------------
@@ -135,9 +182,8 @@
     public void initialize() throws Exception
     {
         m_bp = new DefaultBufferPool( m_config ) ;
-        MerlinBufferPoolMonitor l_monitor = new MerlinBufferPoolMonitor() ;
-        l_monitor.enableLogging( getLogger() ) ;
-        m_bp.setMonitor( l_monitor ) ;
+        m_monitor.enableLogging( getLogger() ) ;
+        m_bp.setMonitor( m_monitor ) ;
     }
 
     
@@ -148,6 +194,7 @@
     public void configure( Configuration a_config ) 
         throws ConfigurationException
     {
+        String l_name = a_config.getChild( "name" ).getValue() ;
         int l_max = Integer.parseInt( a_config
                 .getChild( "maximum" ).getValue() ) ;
         int l_ini = Integer.parseInt( a_config
@@ -157,6 +204,7 @@
         int l_size = Integer.parseInt( a_config
                 .getChild( "bufferSize" ).getValue() ) ;
         
-        m_config = new DefaultBufferPoolConfig( l_inc, l_max, l_ini, l_size ) ;
+        m_config = new DefaultBufferPoolConfig( l_name, l_inc, l_max, 
+                l_ini, l_size ) ;
     }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig	Wed Feb 18 23:52:59 2004
@@ -1,6 +1,7 @@
 <configuration>
+	<name>default</name>
     <bufferSize>4096</bufferSize>
-    <maximum>50</maximum>
-    <initial>10</initial>
-    <increment>5</increment>
+    <maximum>10</maximum>
+    <initial>2</initial>
+    <increment>4</increment>
 </configuration>

Added: incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/test/org/apache/eve/buffer/MerlinBufferPoolTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/test/org/apache/eve/buffer/MerlinBufferPoolTest.java	Wed Feb 18 23:52:59 2004
@@ -0,0 +1,226 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.buffer;
+
+import java.nio.ByteBuffer;
+
+import org.apache.avalon.merlin.unit.AbstractMerlinTestCase;
+import org.apache.eve.ResourceException;
+
+/**
+ * $todo$ doc me
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MerlinBufferPoolTest extends AbstractMerlinTestCase
+{
+    BufferPool m_bp = null ;
+    
+    
+    public MerlinBufferPoolTest( String a_name )
+    {
+        super( a_name ) ;
+    }
+
+    
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( MerlinBufferPoolTest.class ) ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    public void setUp() throws Exception
+    {
+        super.setUp() ;
+        m_bp = ( BufferPool ) resolve( "/server/buffer-pool" ) ; 
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown()
+    {
+        m_bp = null ;
+        super.tearDown() ;
+    }
+    
+    
+    public void testGetConfig() throws Exception
+    {
+        BufferPoolConfig l_config = m_bp.getConfig() ;
+        assertNotNull( "Configuration was null", l_config ) ;
+    }
+    
+
+    public void testGetBuffer() throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+
+
+    public void testGetFreeCount() throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+            assertEquals( "Free count was off", m_bp.size() - ii - 1,
+                    m_bp.getFreeCount() ) ;
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+
+    
+    public void testGetInUseCount() throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+            assertEquals( "In use count was off", ii+1,
+                    m_bp.getInUseCount() ) ;
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+    
+    
+    public void testGetInterestedCount()
+        throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+            assertEquals( "In use count was off", ii+1,
+                    m_bp.getInUseCount() ) ;
+            assertEquals( "Interest count was off", 
+                    1, m_bp.getInterestedCount( l_buffers[ii] ) ) ;
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+
+    
+    public void testReleaseClaim() 
+        throws Exception
+    {
+    }
+
+    
+    public void testSize() 
+        throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+            
+            if ( ii < 2 )
+            {    
+                assertEquals( "size was off", 2, m_bp.size() ) ;
+            }
+            else if ( ii >= 2 && ii < 6 )
+            {
+                assertEquals( "size was off", 6, m_bp.size() ) ;
+            }
+            else if ( ii >= 6 && ii < 10 )
+            {
+                assertEquals( "size was off", 10, m_bp.size() ) ;
+            }
+            else
+            {
+                throw new IllegalStateException( "should never get here!" ) ;
+            }
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+}

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/project.properties
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/project.properties	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/project.properties	Wed Feb 18 23:52:59 2004
@@ -1,3 +1,2 @@
 maven.xdoc.date=left
 maven.xdoc.version=${pom.currentVersion}
-merlin.debug=true

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/project.xml
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/project.xml	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/project.xml	Wed Feb 18 23:52:59 2004
@@ -26,6 +26,13 @@
     <dependencies>
 
         <dependency>
+          <groupId>commons-lang</groupId>
+          <artifactId>commons-lang</artifactId>
+          <version>2.0</version>
+          <url>http://jakarta.apache.org/commons/lang</url>
+        </dependency>
+
+        <dependency>
             <groupId>directory</groupId>
             <artifactId>eve-frontend-common-api</artifactId>
             <version>SNAPSHOT</version>

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/java/org/apache/eve/buffer/DefaultBufferPool.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/java/org/apache/eve/buffer/DefaultBufferPool.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/java/org/apache/eve/buffer/DefaultBufferPool.java	Wed Feb 18 23:52:59 2004
@@ -52,14 +52,18 @@
 
 import java.nio.ByteBuffer ;
 
-import java.util.HashMap ;
 import java.util.ArrayList ;
 
+import org.apache.commons.lang.Validate ;
 import org.apache.eve.ResourceException ;
 
 
 /**
  * The default BufferPool implementation.
+ * 
+ * @see <a 
+ * href="http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=DIR-12">
+ * JIRA Issue</a>
  *
  * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
  * @author $Author$
@@ -69,13 +73,12 @@
 {
     /** a configuration bean */
     private final BufferPoolConfig m_config ;
+    /** list of all buffers */
+    private final ArrayList m_allList ;
     /** list of currently free buffers */
     private final ArrayList m_freeList ;
     /** list of currently in use buffers */
     private final ArrayList m_inUseList ;
-    /** map of buffers to their interest lists */
-    private final HashMap m_interestLists ;
-
     /** the monitor for this DefaultBufferPool */
     private BufferPoolMonitor m_monitor = new BufferPoolMonitorAdapter() ;
     
@@ -90,18 +93,15 @@
         super() ;
         
         m_config = a_config ;
-        m_freeList = new ArrayList( a_config.getIncrement() ) ;
-        m_inUseList = new ArrayList( a_config.getIncrement() ) ;
-        m_interestLists = new HashMap( a_config.getIncrement() ) ;
+        m_freeList = new ArrayList( a_config.getMaximumSize() ) ;
+        m_inUseList = new ArrayList( a_config.getMaximumSize() ) ;
+        m_allList = new ArrayList( a_config.getMaximumSize() ) ;
 
         for( int ii = 0; ii < m_config.getInitialSize(); ii++ )
         {
-            ByteBuffer l_buf = ByteBuffer.allocateDirect( m_config
-                    .getBufferSize() ) ;
-            m_freeList.add( l_buf ) ;
-            
-            // create interest lists in advance for the buffers
-            m_interestLists.put( l_buf, new ArrayList( 3 ) ) ;
+            BufferListPair l_list = new BufferListPair() ;
+            m_freeList.add( l_list ) ;
+            m_allList.add( l_list ) ;
         }
     }
 
@@ -112,18 +112,17 @@
     public synchronized ByteBuffer getBuffer( Object a_party ) 
         throws ResourceException
     {
-        ByteBuffer l_buf = null ;
+        BufferListPair l_list = null ;
         
         if ( m_freeList.size() == 0 )
         {
-            if ( ( m_freeList.size() + m_config.getIncrement() ) <= 
-                    m_config.getMaximumSize() )
+            if ( m_config.getIncrement() <= m_config.getMaximumSize() )
             {
                 for ( int ii = 0; ii < m_config.getIncrement(); ii++ )
                 {
-                    l_buf = ByteBuffer.allocateDirect( m_config
-                            .getBufferSize() ) ; 
-                    m_interestLists.put( l_buf, new ArrayList( 3 ) ) ;
+                    l_list = new BufferListPair() ;
+                    m_freeList.add( l_list ) ;
+                    m_allList.add( l_list ) ;
                 }
             }
             else
@@ -134,15 +133,14 @@
         }
         
         // remove from free list and add to in use list then report to monitir
-        l_buf = ( ByteBuffer ) m_freeList.remove( 0 ) ;
-        m_inUseList.add( l_buf ) ;
-        m_monitor.bufferTaken( this, l_buf, a_party ) ;
+        l_list = ( BufferListPair ) m_freeList.remove( 0 ) ;
+        m_inUseList.add( l_list ) ;
+        m_monitor.bufferTaken( this, l_list.getBuffer(), a_party ) ;
 
         // claim interest on the buffer automatically then report to monitor
-        ArrayList l_list = ( ArrayList ) m_interestLists.get( l_buf ) ;
         l_list.add( a_party ) ;
-        m_monitor.interestClaimed( this, l_buf, a_party ) ;
-        return l_buf ;
+        m_monitor.interestClaimed( this, l_list.getBuffer(), a_party ) ;
+        return l_list.getBuffer() ;
     }
 
     
@@ -153,13 +151,14 @@
     public synchronized void claimInterest( ByteBuffer a_buffer, 
                                             Object a_party )
     {
-        if ( ! m_interestLists.containsKey( a_buffer ) )
+        BufferListPair l_list = getBufferListPair( a_buffer ) ;
+        
+        if ( null == l_list )
         {
             m_monitor.nonPooledBuffer( this, a_buffer, a_party ) ;
             throw new IllegalStateException( "Not a BufferPool resource" ) ;
         }
         
-        ArrayList l_list = ( ArrayList ) m_interestLists.get( a_buffer ) ;
         l_list.add( a_party ) ;
         m_monitor.interestClaimed( this, a_buffer, a_party ) ;
     }
@@ -171,14 +170,14 @@
      */
     public synchronized void releaseClaim( ByteBuffer a_buffer, Object a_party )
     {
-        if ( ! m_interestLists.containsKey( a_buffer ) )
+        BufferListPair l_list = getBufferListPair( a_buffer ) ;
+        
+        if ( null == l_list )
         {
-            m_monitor.nonPooledBuffer( this, a_buffer, a_party ) ;
-            throw new IllegalStateException( "Not a BufferPool resource" ) ;
+            m_monitor.releaseOfUnclaimed( this, a_buffer, a_party ) ;
+            throw new IllegalArgumentException( "Not a pooled resource" ) ;
         }
         
-        ArrayList l_list = ( ArrayList ) m_interestLists.get( a_buffer ) ;
-        
         if ( ! l_list.contains( a_party ) )
         {
             m_monitor.unregisteredParty( this, a_buffer, a_party ) ;
@@ -209,6 +208,54 @@
     }
     
     
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#size()
+     */
+    public synchronized int size()
+    {
+        return m_freeList.size() + m_inUseList.size() ;
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getName()
+     */
+    public String getName()
+    {
+        return m_config.getName() ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getFreeCount()
+     */
+    public synchronized int getFreeCount()
+    {
+        return m_freeList.size() ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getInUseCount()
+     */
+    public synchronized int getInUseCount()
+    {
+        return m_inUseList.size() ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getInterestedCount(
+     * java.nio.ByteBuffer)
+     */
+    public int getInterestedCount( ByteBuffer a_buffer )
+    {
+        BufferListPair l_list = getBufferListPair( a_buffer ) ;
+        Validate.notNull( l_list ) ;
+        return l_list.size() ;
+    }
+    
+    
     /**
      * Gets the monitor.
      * 
@@ -228,5 +275,113 @@
     public void setMonitor( BufferPoolMonitor a_monitor )
     {
         m_monitor = a_monitor ;
+    }
+    
+    
+    /*
+     * (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        StringBuffer l_buf = new StringBuffer( m_config.getName() ) ;
+        l_buf.append( " buffer pool" ) ;
+        return l_buf.toString() ;
+    }
+    
+    
+    // ------------------------------------------------------------------------
+    // code dealing with pairs of buffers and an interested party list 
+    // ------------------------------------------------------------------------
+    
+    
+    /**
+     * Finds and returns a BufferListPair by scanning the complete list of 
+     * pairs looking for the pair that contains the same buffer.
+     * 
+     * @param a_buffer the buffer to search for in the list of pairs
+     * @return null if the buffer does not exist or the pair containing it
+     */
+    BufferListPair getBufferListPair( ByteBuffer a_buffer )
+    {
+        BufferListPair l_list = null ;
+        
+        for ( int ii = 0; ii < m_allList.size(); ii++ )
+        {
+            l_list = ( BufferListPair ) m_allList.get( ii ) ;
+            if ( a_buffer == l_list.getBuffer() )
+            {
+                return l_list ;
+            }
+        }
+        
+        return null ;
+    }
+    
+    
+    /**
+     * Class used to pair up a buffer with a list to track the parties 
+     * interested in the buffer. 
+     */
+    class BufferListPair
+    {
+        final ArrayList m_list ;
+        final ByteBuffer m_buffer ;
+        
+        
+        BufferListPair()
+        {
+            this( new ArrayList( 3 ), 
+                    ByteBuffer.allocateDirect( m_config.getBufferSize() ) ) ;
+        }
+
+        
+        BufferListPair( ByteBuffer a_buffer )
+        {
+            this( new ArrayList( 3 ), a_buffer ) ;
+        }
+
+        
+        BufferListPair( ArrayList a_list, ByteBuffer a_buffer )
+        {
+            m_list = a_list ;
+            m_buffer = a_buffer ;
+        }
+        
+        
+        ByteBuffer getBuffer()
+        {
+            return m_buffer ;
+        }
+        
+        
+        ArrayList getList()
+        {
+            return m_list ;
+        }
+        
+        
+        void add( Object a_party )
+        {
+            m_list.add( a_party ) ;
+        }
+        
+        
+        boolean contains( Object a_party )
+        {
+            return m_list.contains( a_party ) ;
+        }
+        
+        
+        boolean remove( Object a_party )
+        {
+            return m_list.remove( a_party ) ;
+        }
+        
+        
+        int size()
+        {
+            return m_list.size() ;
+        }
     }
 }

Added: incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/test/org/apache/eve/buffer/DefaultBufferPoolTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/pojo-impl/src/test/org/apache/eve/buffer/DefaultBufferPoolTest.java	Wed Feb 18 23:52:59 2004
@@ -0,0 +1,238 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.buffer ;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.eve.ResourceException;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the default buffer pool implementation.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultBufferPoolTest extends TestCase
+{
+
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( DefaultBufferPoolTest.class ) ;
+    }
+
+    
+    /**
+     * Constructor for DefaultBufferPoolTest.
+     * @param arg0
+     */
+    public DefaultBufferPoolTest( String arg0 )
+    {
+        super( arg0 ) ;
+    }
+
+
+    DefaultBufferPool m_bp = null ;
+    
+    
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    public void setUp() throws Exception
+    {
+        super.setUp() ;
+        DefaultBufferPoolConfig l_config = new DefaultBufferPoolConfig(
+                "default", 4, 10, 2, 4096 ) ;
+        m_bp = new DefaultBufferPool( l_config ) ;
+        m_bp.setMonitor( new BufferPoolConsoleLogger() ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+        m_bp = null ;
+        super.tearDown() ;
+    }
+    
+    
+    public void testGetConfig() throws Exception
+    {
+        BufferPoolConfig l_config = m_bp.getConfig() ;
+        assertNotNull( "Configuration was null", l_config ) ;
+    }
+    
+
+    public void testGetBuffer() throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+
+
+    public void testGetFreeCount() throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+            assertEquals( "Free count was off", m_bp.size() - ii - 1,
+                    m_bp.getFreeCount() ) ;
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+
+    
+    public void testGetInUseCount() throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+            assertEquals( "In use count was off", ii+1,
+                    m_bp.getInUseCount() ) ;
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+    
+    
+    public void testGetInterestedCount()
+        throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+            assertEquals( "In use count was off", ii+1,
+                    m_bp.getInUseCount() ) ;
+            assertEquals( "Interest count was off", 
+                    1, m_bp.getInterestedCount( l_buffers[ii] ) ) ;
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+
+    
+    public void testReleaseClaim() 
+        throws Exception
+    {
+    }
+
+    
+    public void testSize() 
+        throws Exception
+    {
+        final int l_max = m_bp.getConfig().getMaximumSize() ;
+        ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+        
+        for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+        {    
+            l_buffers[ii] = m_bp.getBuffer( this ) ;
+            assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+            
+            if ( ii < 2 )
+            {    
+                assertEquals( "size was off", 2, m_bp.size() ) ;
+            }
+            else if ( ii >= 2 && ii < 6 )
+            {
+                assertEquals( "size was off", 6, m_bp.size() ) ;
+            }
+            else if ( ii >= 6 && ii < 10 )
+            {
+                assertEquals( "size was off", 10, m_bp.size() ) ;
+            }
+            else
+            {
+                throw new IllegalStateException( "should never get here!" ) ;
+            }
+        }
+        
+        ByteBuffer l_buf = null ;
+        try
+        {
+            l_buf = m_bp.getBuffer( this ) ;
+        }
+        catch( ResourceException e ) 
+        {
+            assertNull( l_buf ) ;
+            assertNotNull( e ) ;
+        }
+    }
+}

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPool.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPool.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPool.java	Wed Feb 18 23:52:59 2004
@@ -52,7 +52,7 @@
 
 import java.nio.ByteBuffer ;
 
-import org.apache.eve.ResourceException;
+import org.apache.eve.ResourceException ;
 
 
 /**
@@ -106,4 +106,42 @@
      * @return the configuration for this BufferPool
      */
     BufferPoolConfig getConfig() ;
+    
+    /**
+     * Gets the number of interested parties that have claimed interest on a
+     * pooled buffer.  This number is like the link count.
+     * 
+     * @param a_buffer the buffer to get a interest count for
+     * @return count of parties claiming interest on the buffer
+     */
+    int getInterestedCount( ByteBuffer a_buffer ) ; 
+    
+    /**
+     * Gets a count of the number of free buffers in this BufferPool.
+     * 
+     * @return count of free buffers in this BufferPool
+     */
+    int getFreeCount() ;
+    
+    /**
+     * Gets a count of the number of buffers currently being used in this 
+     * BufferPool.
+     * 
+     * @return count of buffers currently being used in this BufferPool
+     */
+    int getInUseCount() ;
+    
+    /**
+     * Gets the current size of this BufferPool.
+     * 
+     * @return the number of buffers total (free and in use) in this BufferPool
+     */
+    int size() ;
+
+    /**
+     * Gets the name of this BufferPool
+     * 
+     * @return the name of this BufferPool
+     */
+    String getName() ;
 }

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConfig.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConfig.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConfig.java	Wed Feb 18 23:52:59 2004
@@ -59,6 +59,13 @@
 public interface BufferPoolConfig
 {
     /**
+     * Gets the name of this BufferPool configuration.
+     * 
+     * @return the name 
+     */
+    String getName() ;
+    
+    /**
      * The increment by which the BufferPool should grow.
      * 
      * @return the increment amount for the BufferPool

Added: incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConsoleLogger.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConsoleLogger.java	Wed Feb 18 23:52:59 2004
@@ -0,0 +1,149 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.buffer;
+
+import java.nio.ByteBuffer;
+
+/**
+ * $todo$ doc me
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class BufferPoolConsoleLogger implements BufferPoolMonitor
+{
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#
+     * augmented(org.apache.eve.buffer.BufferPool)
+     */
+    public void augmented( BufferPool a_bp )
+    {
+        System.out.println( "Just augmented the buffer pool" ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#bufferReleased(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void bufferReleased(
+        BufferPool a_bp,
+        ByteBuffer a_buffer,
+        Object a_releaser)
+    {
+        System.out.println( a_releaser + " released " + a_buffer 
+                + " from pool " + a_bp ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#bufferTaken(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void bufferTaken(
+        BufferPool a_bp,
+        ByteBuffer a_buffer,
+        Object a_taker)
+    {
+        System.out.println( a_taker + " took " + a_buffer 
+                + " from pool " + a_bp ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#interestClaimed(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void interestClaimed(
+        BufferPool a_bp,
+        ByteBuffer a_buffer,
+        Object a_claimer)
+    {
+        System.out.println( a_claimer + " claimed interest in " + a_buffer 
+                + " from pool " + a_bp ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#interestReleased(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void interestReleased(
+        BufferPool a_bp,
+        ByteBuffer a_buffer,
+        Object a_releaser)
+    {
+        System.out.println( a_releaser + " released interest in " + a_buffer 
+                + " from pool " + a_bp ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#nonPooledBuffer(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void nonPooledBuffer(
+        BufferPool a_bp,
+        ByteBuffer a_buffer,
+        Object a_party)
+    {
+        System.out.println( a_party + " tried to release interest in " 
+                + a_buffer + " from pool " + a_bp 
+                + " but resouce was not from this pool.") ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#resourceUnavailable(
+     * org.apache.eve.buffer.BufferPool, java.lang.Object)
+     */
+    public void resourceUnavailable( BufferPool a_bp, Object a_party )
+    {
+        System.out.println( "BufferPool " + a_bp 
+                + " is at capacity - cannot allocate buffer resouce to " 
+                + a_party ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#unregisteredParty(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void unregisteredParty(
+        BufferPool a_bp,
+        ByteBuffer a_buffer,
+        Object a_party)
+    {
+        System.out.println( a_party 
+                + " has not registered as claiming interest on " + a_buffer 
+                + " from pool " + a_bp ) ;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#releaseOfUnclaimed(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void releaseOfUnclaimed( BufferPool a_bp, ByteBuffer a_buffer,
+									Object a_releaser )
+    {
+        System.out.println( a_releaser + " attempted to release interest in " 
+                + a_buffer + " from pool " 
+                + a_bp + " when the buffer was not claimed." ) ;
+    }
+}

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitor.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitor.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitor.java	Wed Feb 18 23:52:59 2004
@@ -70,6 +70,17 @@
     void augmented( BufferPool a_bp ) ;
     
     /**
+     * Monitors the release of an unclaimed buffer which cannot be released if
+     * there is no claim and it is on the free list.
+     * 
+     * @param a_bp the BufferPool the buffer is released back to
+     * @param a_buffer the buffer that is released
+     * @param a_releaser the object doing the releasing
+     */
+    void releaseOfUnclaimed( BufferPool a_bp, ByteBuffer a_buffer, 
+                             Object a_releaser ) ;
+    
+    /**
      * Monitors the giving of a buffer to a client.
      * 
      * @param a_bp the BufferPool the buffer is taken from

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitorAdapter.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitorAdapter.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitorAdapter.java	Wed Feb 18 23:52:59 2004
@@ -140,4 +140,14 @@
                                  Object a_party )
     {
     }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#releaseOfUnclaimed(
+     * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void releaseOfUnclaimed( BufferPool a_bp, ByteBuffer a_buffer,
+									Object a_releaser )
+    {
+    }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/DefaultBufferPoolConfig.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/DefaultBufferPoolConfig.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/DefaultBufferPoolConfig.java	Wed Feb 18 23:52:59 2004
@@ -47,7 +47,8 @@
  Apache Software Foundation, please see <http://www.apache.org/>.
 
 */
-package org.apache.eve.buffer;
+package org.apache.eve.buffer ;
+
 
 /**
  * A BufferPoolConfig implementation bean.
@@ -58,6 +59,8 @@
  */
 public class DefaultBufferPoolConfig implements BufferPoolConfig
 {
+    /** the name */
+    private final String m_name ;
     /** the growth increment */
     private int m_inc = 0 ;
     /** the maximum pool size */
@@ -71,14 +74,16 @@
     /**
      * Creates a BufferPool configuration bean using the supplied values.
      * 
+     * @param a_name the name
      * @param a_inc the growth increment
      * @param a_max the maximum pool size
      * @param a_ini the initial pool size 
      * @param a_size the size of the buffers pooled
      */
-    public DefaultBufferPoolConfig( int a_inc, int a_max, int a_ini, 
-                                    int a_size )
+    public DefaultBufferPoolConfig( String a_name, int a_inc, int a_max, 
+                                    int a_ini, int a_size )
     {
+        m_name = a_name ;
         m_inc = a_inc ;
         m_max = a_max ;
         m_ini = a_ini ;
@@ -119,5 +124,14 @@
     public int getMaximumSize()
     {
         return m_max ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolConfig#getName()
+     */
+    public String getName()
+    {
+        return m_name ;
     }
 }

Mime
View raw message