You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2003/12/08 08:06:55 UTC

svn commit: rev 1390 - in incubator/directory/ldap/trunk/eve/frontend: buffer buffer/impl buffer/impl/conf buffer/impl/src buffer/impl/src/java buffer/impl/src/java/org buffer/impl/src/java/org/apache buffer/impl/src/java/org/apache/eve buffer/impl/src/java/org/apache/eve/buffer buffer/spi buffer/spi/src buffer/spi/src/java buffer/spi/src/java/org buffer/spi/src/java/org/apache buffer/spi/src/java/org/apache/eve buffer/spi/src/java/org/apache/eve/buffer common/api/src/java/org/apache/eve

Author: akarasulu
Date: Sun Dec  7 23:06:55 2003
New Revision: 1390

Added:
   incubator/directory/ldap/trunk/eve/frontend/buffer/
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/   (props changed)
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/block.xml
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/config.xml
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/debug.xml
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/maven.xml
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/project.properties
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/project.xml
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/DefaultBufferPool.java
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig
   incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/   (props changed)
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/project.xml
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPool.java
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConfig.java
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitor.java
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitorAdapter.java
   incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/DefaultBufferPoolConfig.java
   incubator/directory/ldap/trunk/eve/frontend/common/api/src/java/org/apache/eve/ResourceException.java
Log:
Adding the direct memory BufferPool spi and impl projects.


Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/block.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/block.xml	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<container name="server">
+
+  <classloader>
+    <classpath>
+      <repository>
+        <resource id="avalon-framework:avalon-framework-api" version="4.1.5"/>
+        <resource id="directory:eve-frontend-common-api" version="SNAPSHOT"/>
+        <resource id="directory:eve-frontend-buffer-spi" version="SNAPSHOT"/>
+      </repository>
+    </classpath>
+  </classloader>
+
+  <component
+    name="buffer-pool" 
+    class="org.apache.eve.buffer.MerlinBufferPool"/>
+</container>

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/config.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/config.xml	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<targets>
+  <target path="/server/buffer-pool">
+    <categories priority="DEBUG"/>
+  </target>
+</targets>

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/debug.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/conf/debug.xml	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<kernel>
+
+  <!-- logging system parameters -->
+  <logging target="default" priority="DEBUG" name="kernel">
+  </logging>
+
+</kernel>
+

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/maven.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/maven.xml	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,38 @@
+<project default="java:compile"
+    xmlns:j="jelly:core"
+    xmlns:u="jelly:util"
+    xmlns:ant="jelly:ant"
+    xmlns:maven="jelly:maven"
+    xmlns:m="maven"
+    xmlns:deploy="deploy">
+    
+    <preGoal name="site">
+        <attainGoal name="docbook:transform"/>
+    </preGoal>
+
+    <postGoal name="site">
+        <attainGoal name="server:copy-images"/>
+    </postGoal>
+
+    <goal name="server:copy-images">
+        <copy toDir="target/docs/images">
+            <fileSet dir="${basedir}/src/images">
+                <include name="*.gif"/>
+            </fileSet>
+        </copy>
+    </goal>
+    
+    <goal name="cleanall">
+    	<attainGoal name="clean"/>
+    	<delete dir="home"/>
+    </goal>
+    
+    <postGoal name="java:compile">
+    	<attainGoal name="avalon:meta"/>
+    </postGoal>
+    
+    <postGoal name="aspectj:compile">
+    	<attainGoal name="avalon:meta"/>
+    </postGoal>
+    
+</project>

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/project.properties
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/project.properties	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,3 @@
+maven.xdoc.date=left
+maven.xdoc.version=${pom.currentVersion}
+merlin.debug=true

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/project.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/project.xml	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+    <extend>${basedir}/../../../project.xml</extend>
+    <groupId>directory</groupId>
+    <id>eve-frontend-buffer-impl</id>
+  
+    <name>Eve Frontend Buffer Pool Implementation</name>
+    <package>org.apache.eve.buffer</package>
+    <currentVersion>SNAPSHOT</currentVersion>
+    <inceptionYear>2003</inceptionYear>
+  	
+    <shortDescription>
+	Direct buffer pool implementation used by Eve's frontend
+    </shortDescription>
+
+    <description>
+	A pool of direct memory buffer pools of fixed size.  These resouces
+        are expensive to create and destroy unlike regular memory allocated
+        on the Java heap direct memory buffers are allocated outside of the
+        Java managed memory space.  The garbage collector does not apply to
+        direct allocated buffers.  As a consequence it is very costly to 
+        allocate and free direct buffers.  These resources are ideal candidates
+        for pooling.  This is the purpose for this service.
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>avalon-framework</groupId>
+            <artifactId>avalon-framework-api</artifactId>
+            <version>4.1.5</version>
+            <url>http://avalon.apache.org/framework</url>
+        </dependency>
+
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-common-api</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org/ldap/eve/frontend/common/api</url>
+        </dependency>
+
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-buffer-spi</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org</url>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <url>http://junit.org</url>
+        </dependency>
+    </dependencies>
+</project>
+

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/DefaultBufferPool.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/DefaultBufferPool.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,232 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.buffer ;
+
+
+import java.nio.ByteBuffer ;
+
+import java.util.HashMap ;
+import java.util.ArrayList ;
+
+import org.apache.eve.ResourceException ;
+
+
+/**
+ * The default BufferPool implementation.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class DefaultBufferPool implements BufferPool
+{
+    /** a configuration bean */
+	private final BufferPoolConfig m_config ;
+	/** 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() ;
+	
+	
+    /**
+     * Creates a BufferPool using a pool configuration bean.
+     * 
+     * @param a_config the pool configuration bean
+     */
+    public DefaultBufferPool( BufferPoolConfig a_config )
+    {
+        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() ) ;
+
+        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 ) ) ;
+        }
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getBuffer(java.lang.Object)
+     */
+    public synchronized ByteBuffer getBuffer( Object a_party ) 
+    	throws ResourceException
+    {
+		ByteBuffer l_buf = null ;
+		
+        if ( m_freeList.size() == 0 )
+        {
+			if ( ( m_freeList.size() + 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 ) ) ;
+				}
+			}
+			else
+			{    
+				m_monitor.resourceUnavailable( this, a_party ) ;
+			    throw new ResourceException( "Free Buffers unavailable" ) ;
+			}
+        }
+        
+        // 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 ) ;
+
+		// 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 ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#claimInterest(java.nio.ByteBuffer, 
+     * java.lang.Object)
+     */
+    public synchronized void claimInterest( ByteBuffer a_buffer, 
+											Object a_party )
+    {
+        if ( ! m_interestLists.containsKey( a_buffer ) )
+        {
+			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 ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#releaseClaim(java.nio.ByteBuffer, 
+     * java.lang.Object)
+     */
+    public synchronized void releaseClaim( ByteBuffer a_buffer, Object a_party )
+    {
+		if ( ! m_interestLists.containsKey( a_buffer ) )
+		{
+		    m_monitor.nonPooledBuffer( this, a_buffer, a_party ) ;
+			throw new IllegalStateException( "Not a BufferPool resource" ) ;
+		}
+        
+		ArrayList l_list = ( ArrayList ) m_interestLists.get( a_buffer ) ;
+        
+	    if ( ! l_list.contains( a_party ) )
+	    {
+	        m_monitor.unregisteredParty( this, a_buffer, a_party ) ;
+			throw new IllegalStateException( 
+			        "Party never registered interest with buffer" ) ;
+	    }
+	    
+		l_list.remove( a_party ) ;
+		m_monitor.interestReleased( this, a_buffer, a_party ) ;
+		
+		// if the list of interested parties hits zero then we release buf
+		if ( l_list.size() == 0 )
+		{
+            m_inUseList.remove( a_buffer ) ;
+            m_freeList.add( a_buffer ) ;
+            m_monitor.bufferReleased( this, a_buffer, a_party ) ;
+		}
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getConfig()
+     */
+    public BufferPoolConfig getConfig()
+    {
+		return m_config ;
+    }
+    
+    
+    /**
+     * Gets the monitor.
+     * 
+     * @return returns the monitor
+     */
+    public BufferPoolMonitor getMonitor()
+    {
+        return m_monitor ;
+    }
+    
+
+    /**
+     * Sets the monitor.
+     * 
+     * @param a_monitor the monitor to set
+     */
+    public void setMonitor( BufferPoolMonitor a_monitor )
+    {
+        m_monitor = a_monitor ;
+    }
+}

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,162 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.buffer ;
+
+
+import java.nio.ByteBuffer ;
+
+import org.apache.eve.ResourceException ;
+
+import org.apache.avalon.framework.activity.Initializable ;
+import org.apache.avalon.framework.logger.AbstractLogEnabled ;
+import org.apache.avalon.framework.configuration.Configurable ;
+import org.apache.avalon.framework.configuration.Configuration ;
+import org.apache.avalon.framework.configuration.ConfigurationException ;
+
+
+/**
+ * A Merlin BufferPool service. 
+ * 
+ * @avalon.component name="buffer-pool" lifestyle="singleton"
+ * @avalon.service type="org.apache.eve.buffer.BufferPool" version="1.0"
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class MerlinBufferPool
+    extends AbstractLogEnabled
+    implements BufferPool, Initializable, Configurable
+{
+    /** the underlying BufferPool implementation wrapped by this service */
+    private DefaultBufferPool m_bp = null ;
+    /** the configuration bean for this BufferPool */
+    private BufferPoolConfig m_config = null ;
+    
+    
+	// ------------------------------------------------------------------------
+	// BufferPool Interface Methods
+	// ------------------------------------------------------------------------
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getBuffer(java.lang.Object)
+     */
+    public ByteBuffer getBuffer( Object a_party ) throws ResourceException
+    {
+        return m_bp.getBuffer( a_party ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#claimInterest(java.nio.ByteBuffer,
+     * java.lang.Object)
+     */
+    public void claimInterest( ByteBuffer a_buffer, Object a_party )
+    {
+        m_bp.claimInterest( a_buffer, a_party ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#releaseClaim(
+     * java.nio.ByteBuffer, java.lang.Object)
+     */
+    public void releaseClaim( ByteBuffer a_buffer, Object a_party )
+    {
+        m_bp.releaseClaim( a_buffer, a_party ) ;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPool#getConfig()
+     */
+    public BufferPoolConfig getConfig()
+    {
+        return m_config ;
+    }
+    
+    
+	// ------------------------------------------------------------------------
+    // Avalon Life Cycle Methods
+	// ------------------------------------------------------------------------
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.activity.Initializable#initialize()
+     */
+    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 ) ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(
+     * org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure( Configuration a_config ) 
+    	throws ConfigurationException
+    {
+        int l_max = Integer.parseInt( a_config
+                .getChild( "maximum" ).getValue() ) ;
+		int l_ini = Integer.parseInt( a_config
+				.getChild( "initial" ).getValue() ) ;
+		int l_inc = Integer.parseInt( a_config
+				.getChild( "increment" ).getValue() ) ;
+		int l_size = Integer.parseInt( a_config
+				.getChild( "bufferSize" ).getValue() ) ;
+		
+		m_config = new DefaultBufferPoolConfig( l_inc, l_max, l_ini, l_size ) ;
+    }
+}

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,6 @@
+<configuration>
+    <bufferSize>4096</bufferSize>
+    <maximum>50</maximum>
+    <initial>10</initial>
+    <increment>5</increment>
+</configuration>
\ No newline at end of file

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,143 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.buffer;
+
+import java.nio.ByteBuffer;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
+/**
+ * $todo$ doc me
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class MerlinBufferPoolMonitor
+    extends AbstractLogEnabled
+    implements BufferPoolMonitor
+{
+	/* (non-Javadoc)
+	 * @see org.apache.eve.buffer.BufferPoolMonitor#augmented(
+	 * org.apache.eve.buffer.BufferPool)
+	 */
+	public void augmented( BufferPool 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 )
+	{
+	}
+
+    
+	/* (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 )
+	{
+	}
+
+    
+	/* (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 )
+	{
+	}
+    
+
+	/* (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 )
+	{
+	}
+
+	/*
+	 * (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 ) 
+	{
+	}
+
+	/*
+	 * (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 ) 
+	{
+	}
+    
+	/*
+	 * (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 )
+	{
+	}
+}

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/spi/project.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/spi/project.xml	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+    <extend>${basedir}/../../../project.xml</extend>
+    <groupId>directory</groupId>
+    <id>eve-frontend-buffer-spi</id>
+  
+    <name>Eve Frontend Buffer Pool Service SPI</name>
+    <package>org.apache.eve.buffer</package>
+    <currentVersion>SNAPSHOT</currentVersion>
+    <inceptionYear>2003</inceptionYear>
+  	
+    <shortDescription>Event Buffer Pool SPI used by Eve's frontend</shortDescription>
+
+    <description>
+        A buffer pool service for claiming and releasing pooled preallocated
+        NIO direct buffers.  The service tracks the parties interested in
+        the buffer as which is used to maintain a reference count on the buffer
+        but with actual references. 
+    </description>
+  	
+    <dependencies>
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-common-api</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org/ldap/eve/frontend/common/api</url>
+        </dependency>
+    </dependencies>
+</project>
+

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPool.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPool.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,109 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.buffer ;
+
+
+import java.nio.ByteBuffer ;
+
+import org.apache.eve.ResourceException;
+
+
+/**
+ * Service interface for an NIO direct memory buffer pool.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public interface BufferPool
+{
+    /** for Avalon compatability */
+    String ROLE = BufferPool.class.getName() ;
+    
+    /**
+     * Acquires a dedicated buffer from the buffer pool and claims interest with
+     * the buffer using an object representing the interested party.
+     * 
+     * @param a_party the object interested in the buffer
+     * @return a claimed direct memory buffer
+     */
+    ByteBuffer getBuffer( Object a_party ) throws ResourceException ;
+    
+    /**
+     * Allows a party to claim interest on a buffer pooled by this buffer.  The
+     * buffer cannot be reclaimed until all the interested parties release their
+     * interest claim on the buffer.
+     * 
+     * @param a_party the object interested in the buffer
+     * @param a_buffer a claimed direct memory buffer pooled by this BufferPool
+     * @throws IllegalArgumentException if the buffer is not direct or has not 
+     * been recognized as a pooled resource of this pool. 
+     */
+    void claimInterest( ByteBuffer a_buffer, Object a_party ) ; 
+    
+    /**
+     * Allows a party that claimed interest on a buffer to release the buffer.  
+     * The buffer cannot be reclaimed until all the interested parties release 
+     * their interest claim on the buffer.
+     * 
+     * @param a_buffer the buffer to release
+     * @param a_owner the owner of the buffer
+     * @throws IllegalArgumentException if the buffer is not direct or has not 
+     * been recognized as a pooled resource of this pool. 
+     */
+    void releaseClaim( ByteBuffer a_buffer, Object a_party ) ;
+    
+    /**
+     * Gets the configuration for this BufferPool.
+     * 
+     * @return the configuration for this BufferPool
+     */
+    BufferPoolConfig getConfig() ;
+}

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConfig.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolConfig.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,91 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.buffer ;
+
+/**
+ * BufferPool configuration parameters used regardless of implementation.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public interface BufferPoolConfig
+{
+    /**
+     * The increment by which the BufferPool should grow.
+     * 
+     * @return the increment amount for the BufferPool
+     */
+    int getIncrement() ;
+    
+    /**
+     * The size of the buffers that are pooled.  Recommended settings are of 
+     * multiples of 1024: 1k, 2k, 4k and 8k.
+     * 
+     * @return the size of the pooled buffers
+     */
+	int getBufferSize() ;
+	
+	/**
+	 * Gets the initial size of the pool.  This should be a multiple of the 
+	 * pool's growth increment.
+	 * 
+	 * @return the initial pool size.
+	 */
+    int getInitialSize() ;
+    
+    /**
+     * The maximum size a BufferPool can grow to.  This should be a multiple of
+     * the pool's growth increment.
+     * 
+     * @return the maximum pool size.
+     */
+    int getMaximumSize() ;
+}

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitor.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,140 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.buffer ;
+
+
+import java.nio.ByteBuffer ;
+
+
+/**
+ * The BufferPool monitor interface.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public interface BufferPoolMonitor
+{
+    /**
+     * Monitors the augmentation of a BufferPool.
+     * 
+     * @param a_bp the BufferPool that grew
+     */
+    void augmented( BufferPool a_bp ) ;
+    
+    /**
+     * Monitors the giving of a buffer to a client.
+     * 
+     * @param a_bp the BufferPool the buffer is taken from
+     * @param a_buffer the buffer that is taken
+     * @param a_taker the object doing the taking
+     */
+    void bufferTaken( BufferPool a_bp, ByteBuffer a_buffer, Object a_taker ) ;
+    
+    /**
+     * Monitors the release of a buffer to be reclaimed onto 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 bufferReleased( BufferPool a_bp, ByteBuffer a_buffer, 
+						 Object a_releaser ) ;
+    
+	/**
+	 * Monitors the claim of interest in a buffer.
+	 * 
+	 * @param a_bp the BufferPool the buffer of interest is from
+	 * @param a_buffer the buffer that is the interest
+	 * @param a_claimer the object doing the interest claiming
+	 */
+	void interestClaimed( BufferPool a_bp,  ByteBuffer a_buffer, 
+						  Object a_claimer ) ;
+	
+	/**
+	 * Monitors the release of a claim on a buffer.
+	 * 
+	 * @param a_bp the BufferPool the buffer of interest is from
+	 * @param a_buffer the buffer that has an interest claim released
+	 * @param a_releaser the object doing the interest claim releasing
+	 */
+	void interestReleased( BufferPool a_bp,  ByteBuffer a_buffer, 
+						  Object a_releaser ) ;
+
+	/**
+	 * Monitors situations where the BufferPool is in full use at its maximum 
+	 * capacity and a request for a Buffer cannot be satisfied.
+	 * 
+	 * @param a_bp the BufferPool the where the buffer is unavailable
+	 * @param a_party the party trying to acquire the buffer resource
+	 */
+	void resourceUnavailable( BufferPool a_bp, Object a_party ) ;
+	
+	/**
+	 * A party that never registered interest in a buffer is attempting to 
+	 * remove its interest on a buffer.
+	 * 
+	 * @param a_bp the buffer pool this fault is occuring in
+	 * @param a_buffer the buffer the party is trying to claim interest on
+	 * @param a_party the party trying to claim interest
+	 */
+	void unregisteredParty( BufferPool a_bp, ByteBuffer a_buffer, 
+							Object a_party ) ;
+	
+	/**
+	 * Monitors attempts to deal with a buffer that is not a pooled resource.
+	 * 
+	 * @param a_bp the BufferPool that does not contain the buffer
+	 * @param a_buffer the buffer that is not pooled in the BufferPool
+	 * @param a_party the party that attempted the operation causing the fault
+	 */
+	void nonPooledBuffer( BufferPool a_bp, ByteBuffer a_buffer, 
+						  Object a_party ) ;
+}

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitorAdapter.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/BufferPoolMonitorAdapter.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,143 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.buffer ;
+
+
+import java.nio.ByteBuffer ;
+
+
+/**
+ * A BufferPoolMonitor adapter to extend to monitor only those signals that
+ * are of interest.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class BufferPoolMonitorAdapter implements BufferPoolMonitor
+{
+
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolMonitor#augmented(
+     * org.apache.eve.buffer.BufferPool)
+     */
+    public void augmented( BufferPool 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 )
+    {
+    }
+
+    
+    /* (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 )
+    {
+    }
+
+    
+    /* (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 )
+    {
+    }
+    
+
+    /* (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 )
+    {
+    }
+
+    /*
+     * (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 ) 
+    {
+    }
+
+    /*
+     * (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 ) 
+    {
+    }
+    
+    /*
+     * (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 )
+	{
+	}
+}

Added: incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/DefaultBufferPoolConfig.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/buffer/spi/src/java/org/apache/eve/buffer/DefaultBufferPoolConfig.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,123 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.buffer;
+
+/**
+ * A BufferPoolConfig implementation bean.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class DefaultBufferPoolConfig implements BufferPoolConfig
+{
+    /** the growth increment */
+    private int m_inc = 0 ;
+    /** the maximum pool size */
+    private int m_max = 0 ;
+    /** the initial pool size */
+	private int m_ini = 0 ;
+	/** the size of the buffers pooled */
+    private int m_size = 0 ;
+    
+    
+    /**
+     * Creates a BufferPool configuration bean using the supplied values.
+     * 
+     * @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 )
+    {
+        m_inc = a_inc ;
+        m_max = a_max ;
+        m_ini = a_ini ;
+        m_size = a_size ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolConfig#getIncrement()
+     */
+    public int getIncrement()
+    {
+        return m_inc ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolConfig#getBufferSize()
+     */
+    public int getBufferSize()
+    {
+        return m_size ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolConfig#getInitialSize()
+     */
+    public int getInitialSize()
+    {
+        return m_ini ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.buffer.BufferPoolConfig#getMaximumSize()
+     */
+    public int getMaximumSize()
+    {
+        return m_max ;
+    }
+}

Added: incubator/directory/ldap/trunk/eve/frontend/common/api/src/java/org/apache/eve/ResourceException.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/common/api/src/java/org/apache/eve/ResourceException.java	Sun Dec  7 23:06:55 2003
@@ -0,0 +1,80 @@
+package org.apache.eve;
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+
+
+/**
+ * Exception thrown when a resource was needed and could not be acquired. 
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class ResourceException extends Exception
+{
+    /**
+     * Creates a simple ResourceException without any details. 
+     */
+    public ResourceException()
+    {
+        super() ;
+    }
+
+
+    /**
+     * Creates a simple ResourceException with a message.
+     *  
+     * @param a_message a detailed message
+     */
+    public ResourceException( String a_message )
+    {
+        super( a_message ) ;
+    }
+}