directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 6446 - in incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl: . conf src src/docbook src/images src/java src/java/org src/java/org/apache src/java/org/apache/eve src/java/org/apache/eve/buffer
Date Tue, 03 Feb 2004 06:48:30 GMT
Author: akarasulu
Date: Mon Feb  2 22:48:30 2004
New Revision: 6446

Added:
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/conf/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/conf/block.xml
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/conf/config.xml
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/conf/debug.xml
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/maven.xml
   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/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/docbook/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/images/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/
   incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/
   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/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java
Log:
merlin specific wrapper implementation

Added: incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/conf/block.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/conf/block.xml	Mon Feb 
2 22:48:30 2004
@@ -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/eve/trunk/eve/frontend/buffer/merlin-impl/conf/config.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/conf/config.xml	Mon Feb
 2 22:48:30 2004
@@ -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/eve/trunk/eve/frontend/buffer/merlin-impl/conf/debug.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/conf/debug.xml	Mon Feb 
2 22:48:30 2004
@@ -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/eve/trunk/eve/frontend/buffer/merlin-impl/maven.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/maven.xml	Mon Feb  2 22:48:30
2004
@@ -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/eve/trunk/eve/frontend/buffer/merlin-impl/project.properties
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.properties	Mon Feb
 2 22:48:30 2004
@@ -0,0 +1,3 @@
+maven.xdoc.date=left
+maven.xdoc.version=${pom.currentVersion}
+merlin.debug=true

Added: incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/project.xml	Mon Feb  2 22:48:30
2004
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+    <extend>${basedir}/../../../project.xml</extend>
+    <groupId>directory</groupId>
+    <id>eve-frontend-buffer-merlin-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>directory</groupId>
+            <artifactId>eve-frontend-buffer-pojo-impl</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/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.java
Mon Feb  2 22:48:30 2004
@@ -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:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $Author: akarasulu $
+ * @version $Rev: 6444 $
+ */
+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/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPool.xconfig
Mon Feb  2 22:48:30 2004
@@ -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/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/buffer/merlin-impl/src/java/org/apache/eve/buffer/MerlinBufferPoolMonitor.java
Mon Feb  2 22:48:30 2004
@@ -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:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $Author: akarasulu $
+ * @version $Rev: 6444 $
+ */
+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 )
+    {
+    }
+}

Mime
View raw message