directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r164638 - in /directory/sandbox/trunk/asn1-new-codec/src: java/org/apache/asn1/ber/ java/org/apache/asn1/ldap/codec/grammars/ java/org/apache/asn1/util/pools/ perfs/org/apache/ans1/ber/ test/org/apache/asn1/ldap/codec/ test/org/apache/asn1/ldap/codec/utils/
Date Mon, 25 Apr 2005 20:32:13 GMT
Author: elecharny
Date: Mon Apr 25 13:32:12 2005
New Revision: 164638

URL: http://svn.apache.org/viewcvs?rev=164638&view=rev
Log:
Changed the way pools were allocated in order to be able to use thjem for something else than
Ldap.

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/Asn1Decoder.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapMessageGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapResultGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapStatesEnum.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/GlobalPoolManager.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/LocalPoolManager.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/PoolEnum.java
    directory/sandbox/trunk/asn1-new-codec/src/perfs/org/apache/ans1/ber/LdapDecoderPerf.java
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindRequestTest.java
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindResponseTest.java
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/LdapDecoderTest.java
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/Asn1Decoder.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/Asn1Decoder.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/Asn1Decoder.java Mon
Apr 25 13:32:12 2005
@@ -22,6 +22,7 @@
 import org.apache.asn1.ber.tlv.Length;
 import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ber.tlv.ITLVBerDecoderMBean;
+import org.apache.asn1.ber.tlv.TLVPoolEnum;
 import org.apache.asn1.ber.tlv.TLVStateEnum;
 import org.apache.asn1.ber.tlv.Tag;
 import org.apache.asn1.util.StringUtils;
@@ -71,10 +72,10 @@
     private int maxTagLength;
 
     /** The local pool Manager */
-    private LocalPoolManager poolMgr;
+    protected LocalPoolManager poolMgr;
     
     /** A flag to set the memory mechanism to use */
-    private boolean isPooled;
+    protected boolean isPooled;
     
     //~ Constructors -------------------------------------------------------------------------------
 
@@ -89,7 +90,7 @@
         this.indefiniteLengthAllowed = false;
         this.maxLengthLength         = 1;
         this.maxTagLength            = 1;
-        poolMgr                      = new LocalPoolManager(isPooled);
+        poolMgr                      = new LocalPoolManager(60, isPooled);
     }
 
     /**
@@ -101,7 +102,7 @@
         this.maxLengthLength         = 1;
         this.maxTagLength            = 1;
         isPooled                     = true;
-        poolMgr                      = new LocalPoolManager(isPooled);
+        poolMgr                      = new LocalPoolManager(60, isPooled);
     }
 
     //~ Methods ------------------------------------------------------------------------------------
@@ -130,7 +131,7 @@
             try
             {
 
-                TLV tlv = ( TLV ) poolMgr.allocate( PoolEnum.TLV_POOL );
+                TLV tlv = ( TLV ) poolMgr.allocate( TLVPoolEnum.TLV_POOL );
                 Tag tag = tlv.getTag();
 
                 tag.setSize( 1 );

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindRequestGrammar.java
Mon Apr 25 13:32:12 2005
@@ -25,6 +25,7 @@
 import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ber.tlv.Value;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
+import org.apache.asn1.ldap.codec.LdapPoolEnum;
 import org.apache.asn1.ldap.codec.primitives.LdapDN;
 import org.apache.asn1.ldap.codec.primitives.LdapString;
 import org.apache.asn1.ldap.codec.utils.IntegerDecoder;
@@ -33,7 +34,6 @@
 import org.apache.asn1.ldap.pojo.SaslAuthenticationPOJO;
 import org.apache.asn1.ldap.pojo.SimpleAuthenticationPOJO;
 import org.apache.asn1.util.MutableString;
-import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.asn1.util.pools.PoolException;
 
 import org.apache.log4j.Logger;
@@ -117,7 +117,7 @@
                             // Now, we can allocate the BindRequest POJO
                             BindRequestPOJO bindRequest = ( BindRequestPOJO )
                                 ldapMessageContainer.getPoolManager().allocate(
-                                    PoolEnum.BIND_REQUEST_POJO_POOL );
+                                    LdapPoolEnum.BIND_REQUEST_POJO_POOL );
 
                             // As this is a new Constructed object, we have to init its length
                             TLV tlv            = ldapMessageContainer.getCurrentTLV();
@@ -295,7 +295,7 @@
 
                             authentication = ( SimpleAuthenticationPOJO )
                                 ldapMessageContainer.getPoolManager().allocate(
-                                    PoolEnum.SIMPLE_AUTH_POJO_POOL );
+                                        LdapPoolEnum.SIMPLE_AUTH_POJO_POOL );
 
                             authentication.setFather( bindRequestMessage );
 
@@ -393,7 +393,7 @@
                         {
                             authentication = ( SaslAuthenticationPOJO )
                                 ldapMessageContainer.getPoolManager().allocate(
-                                    PoolEnum.SASL_AUTH_POJO_POOL );
+                                        LdapPoolEnum.SASL_AUTH_POJO_POOL );
 
                             authentication.setFather( bindRequestMessage );
 

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/BindResponseGrammar.java
Mon Apr 25 13:32:12 2005
@@ -24,9 +24,9 @@
 import org.apache.asn1.ber.grammar.IGrammar;
 import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
+import org.apache.asn1.ldap.codec.LdapPoolEnum;
 import org.apache.asn1.ldap.pojo.BindResponsePOJO;
 import org.apache.asn1.ldap.pojo.LdapMessagePOJO;
-import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.asn1.util.pools.PoolException;
 
 import org.apache.log4j.Logger;
@@ -100,7 +100,7 @@
                             // Now, we can allocate the BindRequest POJO
                             BindResponsePOJO bindResponse = ( BindResponsePOJO )
                                 ldapMessageContainer.getPoolManager().allocate(
-                                    PoolEnum.BIND_RESPONSE_POJO_POOL );
+                                        LdapPoolEnum.BIND_RESPONSE_POJO_POOL );
 
                             // As this is a new Constructed object, we have to init its length
                             TLV tlv            = ldapMessageContainer.getCurrentTLV();

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapMessageGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapMessageGrammar.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapMessageGrammar.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapMessageGrammar.java
Mon Apr 25 13:32:12 2005
@@ -25,9 +25,9 @@
 import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ber.tlv.Value;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
+import org.apache.asn1.ldap.codec.LdapPoolEnum;
 import org.apache.asn1.ldap.codec.utils.IntegerDecoder;
 import org.apache.asn1.ldap.pojo.LdapMessagePOJO;
-import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.asn1.util.pools.PoolException;
 
 import org.apache.log4j.Logger;
@@ -93,7 +93,7 @@
 	                        // First, create a empty LdapMessage POJO
 	                    	LdapMessagePOJO ldapMessage = ( LdapMessagePOJO )
 	                            ldapMessageContainer.getPoolManager().allocate(
-	                                PoolEnum.LDAP_MESSAGE_POJO_POOL );
+	                                    LdapPoolEnum.LDAP_MESSAGE_POJO_POOL );
 	
 	                        // Then stores it into the container
 	                        ldapMessageContainer.setLdapMessage(ldapMessage);

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapResultGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapResultGrammar.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapResultGrammar.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapResultGrammar.java
Mon Apr 25 13:32:12 2005
@@ -25,6 +25,7 @@
 import org.apache.asn1.ber.tlv.TLV;
 import org.apache.asn1.ber.tlv.Value;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
+import org.apache.asn1.ldap.codec.LdapPoolEnum;
 import org.apache.asn1.ldap.codec.primitives.LdapDN;
 import org.apache.asn1.ldap.codec.primitives.LdapString;
 import org.apache.asn1.ldap.codec.utils.IntegerDecoder;
@@ -33,7 +34,6 @@
 import org.apache.asn1.ldap.pojo.LdapMessagePOJO;
 import org.apache.asn1.ldap.pojo.LdapResultPOJO;
 import org.apache.asn1.util.MutableString;
-import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.asn1.util.pools.PoolException;
 
 import org.apache.log4j.Logger;
@@ -105,7 +105,7 @@
                         try
                         {
                             ldapResult = ( LdapResultPOJO ) ( ldapMessageContainer.getPoolManager()
-                                    .allocate( PoolEnum.LDAP_RESULT_POJO_POOL ) );
+                                    .allocate( LdapPoolEnum.LDAP_RESULT_POJO_POOL ) );
                             bindResponse.setLdapResult( ldapResult );
                         }
                         catch ( PoolException pe )

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapStatesEnum.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapStatesEnum.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapStatesEnum.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/LdapStatesEnum.java
Mon Apr 25 13:32:12 2005
@@ -62,22 +62,23 @@
     public static int PROTOCOL_OP_LENGTH = 7;
 
     /** protocolOp CHOICE Value */
-    public static int PROTOCOL_OP_VALUE = 8;
-    
+    public static int PROTOCOL_OP_VALUE       = 8;
+
+    /** DOCUMENT ME! */
     public static int LAST_LDAP_MESSAGE_STATE = 9;
-    
-    
+
 
     // BindRequest ============================================================
     // Version ----------------------------------------------------------------
+    /** DOCUMENT ME! */
     private static int BIND_REQUEST_STATE = 0;
 
     /** The BindRequest Tag */
     public static int BIND_REQUEST_TAG = 0;
-    
+
     /** BIND_REQUEST Length */
     public static int BIND_REQUEST_LENGTH = 1;
-    
+
     /** The BindRequest Value */
     public static int BIND_REQUEST_VALUE = 2;
 
@@ -144,12 +145,14 @@
     /** Authentication sasl credentials Value */
     public static int BIND_REQUEST_AUTHENTICATION_CREDENTIALS_VALUE = 19;
 
+    /** DOCUMENT ME! */
     public static int LAST_BIND_REQUEST_STATE = 20;
 
-    
+
     // Controls ===============================================================
+    /** DOCUMENT ME! */
     private static int LDAP_CONTROL_STATE = 0;
-    
+
     /** Controls Tag */
     public static int CONTROLS_TAG = 1;
 
@@ -198,12 +201,13 @@
 
     /** Control value Value */
     public static int CONTROL_VALUE_VALUE = 15;
-    
+
     /** Control last state */
     public static int CONTROL_LAST_STATE = 16;
 
     // BindResponse ===========================================================
     // Version ----------------------------------------------------------------
+    /** DOCUMENT ME! */
     private static int BIND_RESPONSE_STATE = 0;
 
     /**  Response Tag */
@@ -231,12 +235,13 @@
     public static int BIND_RESPONSE_SERVER_SASL_CREDS_VALUE = 7;
 
     /** Last state */
-    public static int LAST_LDAP_STATE = 8; 
-    
-    
+    public static int LAST_LDAP_STATE = 8;
+
+
     // LdapResult grammar states ==============================================
+    /** DOCUMENT ME! */
     private static int LDAP_RESULT_STATE = 0;
-    
+
     // LdapResult Code --------------------------------------------------------
     /** LdapResult Code Tag */
     public static int LDAP_RESULT_CODE_TAG = 0;
@@ -283,7 +288,7 @@
 
     /** LdapResult referral Value */
     public static int LDAP_RESULT_REFERRAL_VALUE = 13;
-    
+
     /** LdapResult referral Tag loop */
     public static int LDAP_RESULT_REFERRAL_LOOP_TAG = 14;
 
@@ -391,8 +396,6 @@
             "BIND_RESPONSE_MESSAGE_ID_TAG", "SERVER_SASL_CREDS_TAG", "SERVER_SASL_CREDS_LENGTH",
             "SERVER_SASL_CREDS_VALUE", "LAST_STATE"
         };
-
-    //~ Instance fields ----------------------------------------------------------------------------
 
     /** The instance */
     private static LdapStatesEnum instance = new LdapStatesEnum();

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/GlobalPoolManager.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/GlobalPoolManager.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/GlobalPoolManager.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/GlobalPoolManager.java
Mon Apr 25 13:32:12 2005
@@ -16,22 +16,6 @@
  */
 package org.apache.asn1.util.pools;
 
-import org.apache.asn1.ber.tlv.TLVFactory;
-import org.apache.asn1.ldap.codec.LdapMessageContainerFactory;
-import org.apache.asn1.ldap.pojo.factories.BindRequestPOJOFactory;
-import org.apache.asn1.ldap.pojo.factories.BindResponsePOJOFactory;
-import org.apache.asn1.ldap.pojo.factories.LdapMessagePOJOFactory;
-import org.apache.asn1.ldap.pojo.factories.LdapResultPOJOFactory;
-import org.apache.asn1.ldap.pojo.factories.SaslAuthenticationPOJOFactory;
-import org.apache.asn1.ldap.pojo.factories.SimpleAuthenticationPOJOFactory;
-import org.apache.asn1.util.MutableString1024Factory;
-import org.apache.asn1.util.MutableString128Factory;
-import org.apache.asn1.util.MutableString16Factory;
-import org.apache.asn1.util.MutableString256Factory;
-import org.apache.asn1.util.MutableString32Factory;
-import org.apache.asn1.util.MutableString512Factory;
-import org.apache.asn1.util.MutableString64Factory;
-import org.apache.asn1.util.MutableStringFactory;
 import org.apache.asn1.util.ObjectFactory;
 
 import org.apache.log4j.Logger;
@@ -54,7 +38,7 @@
     protected static final boolean DEBUG = log.isDebugEnabled();
 
     /** Array of pools */
-    private static GlobalPool[] pools = new GlobalPool[PoolEnum.POOL_NUMBER];
+    private static GlobalPool[] pools;
 
     /** Initialize the Global Pools. This method is a singleton */
     private static GlobalPoolManager instance = new GlobalPoolManager();
@@ -62,59 +46,43 @@
     //~ Constructors -------------------------------------------------------------------------------
 
     /**
+     * Initialize the global pool manager with a number of pool to be created
+     * 
+     * @param nbPools The number of pools to create.
+     */
+    public static synchronized void initialize(int nbPools)
+    {
+        pools = new GlobalPool[nbPools];
+    }
+
+    /**
+     * Return an instance on the global pool manager
+     * @return THe global pool manager
+     */
+    public static GlobalPoolManager getInstance()
+    {
+        return instance;
+    }
+    
+    /**
+     * Initialize a new Global Pool object.
+     *
+     * @param poolId The pool unique identifier 
+     * @param objectFactory The object factory to create objects
+     * @param initialCapacity The initial size of the pool
+     * @param maxCapacity 
+     */
+    public void initPool(int poolId, ObjectFactory objectFactory, int initialCapacity, int
maxCapacity)
+    {
+        pools[poolId] = new GlobalPool( objectFactory, initialCapacity, maxCapacity);
+    }
+    
+    /**
      * Creates a new GlobalPoolManager object. It's aprivate, the class
      * is a singleton.
      */
     private GlobalPoolManager()
     {
-
-        pools[PoolEnum.TLV_POOL]                     = new GlobalPool( new TLVFactory(),
1024,
-                10240 );
-        
-        pools[PoolEnum.SIMPLE_AUTH_POJO_POOL]        = new GlobalPool(
-                new SimpleAuthenticationPOJOFactory(), 128, 1024 );
-        
-        pools[PoolEnum.SASL_AUTH_POJO_POOL]          = new GlobalPool(
-                new SaslAuthenticationPOJOFactory(), 128, 1024 );
-        
-        pools[PoolEnum.BIND_RESPONSE_POJO_POOL]      = new GlobalPool(
-                new BindResponsePOJOFactory(), 128, 1024 );
-        
-        pools[PoolEnum.BIND_REQUEST_POJO_POOL]       = new GlobalPool( new BindRequestPOJOFactory(),
-                128, 1024 );
-        
-        pools[PoolEnum.LDAP_MESSAGE_POJO_POOL]  = new GlobalPool(
-                new LdapMessagePOJOFactory(), 128, 1024 );
-
-        pools[PoolEnum.LDAP_RESULT_POJO_POOL]  = new GlobalPool(
-                new LdapResultPOJOFactory(), 128, 1024 );
-
-        pools[PoolEnum.LDAP_MESSAGE_CONTAINER_POOL]  = new GlobalPool(
-                new LdapMessageContainerFactory(), 128, 1024 );
-
-        pools[PoolEnum.STRING_POOL_16] = new GlobalPool(
-                new MutableString16Factory(), 10240, 10240 );
-
-        pools[PoolEnum.STRING_POOL_32] = new GlobalPool(
-                new MutableString32Factory(), 10240, 10240 );
-        
-        pools[PoolEnum.STRING_POOL_64] = new GlobalPool(
-                new MutableString64Factory(), 10240, 10240 );
-        
-        pools[PoolEnum.STRING_POOL_128] = new GlobalPool(
-                new MutableString128Factory(), 5120, 5120 );
-        
-        pools[PoolEnum.STRING_POOL_256] = new GlobalPool(
-                new MutableString256Factory(), 1024, 1024 );
-        
-        pools[PoolEnum.STRING_POOL_512] = new GlobalPool(
-                new MutableString512Factory(), 512, 512 );
-
-        pools[PoolEnum.STRING_POOL_1024] = new GlobalPool(
-                new MutableString1024Factory(), 256, 256 );
-
-        pools[PoolEnum.STREAMED_STRING_POOL] = new GlobalPool(
-                new MutableStringFactory(), 256, 256 );
     }
 
     //~ Methods ------------------------------------------------------------------------------------

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/LocalPoolManager.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/LocalPoolManager.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/LocalPoolManager.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/LocalPoolManager.java
Mon Apr 25 13:32:12 2005
@@ -17,6 +17,7 @@
 package org.apache.asn1.util.pools;
 
 
+import org.apache.asn1.util.ObjectFactory;
 import org.apache.log4j.Logger;
 
 
@@ -52,7 +53,7 @@
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** Array of pools */
-    private LocalPool[] pools = new LocalPool[PoolEnum.POOL_NUMBER];
+    private LocalPool[] pools;
     
     /** A flag that sets the memory allocation mechanism */
     private boolean isPooled;
@@ -62,69 +63,40 @@
     /**
      * Creates a new LocalPoolManager object. All the objects that could be allocated are
stored in 
      * local pools.
+     * 
+     * @param nbPools The number of pools to create
+     * @param isPooled Tells if the data are pooled or created on the fly with a new 
      */
-    public LocalPoolManager(boolean isPooled)
+    public LocalPoolManager(int nbPools, boolean isPooled)
     {
     	this.isPooled = isPooled;
     	
     	if (isPooled)
     	{
-	        // We have to initialize the pools.
-	        // Tag and TLV pool will be bigger than others, because PDU may contain many of
them
-	        // for only one POJO generated.
-	        //
-	        // TODO It has to be improved. Picocontainer?
-	        pools[PoolEnum.TLV_POOL]                     = new LocalPool( PoolEnum.TLV_POOL,
10240,
-	                1024 );
-	        
-	        pools[PoolEnum.SIMPLE_AUTH_POJO_POOL]        = new LocalPool(
-	                PoolEnum.SIMPLE_AUTH_POJO_POOL, 1024, 1024 );
-	        
-	        pools[PoolEnum.SASL_AUTH_POJO_POOL]          = new LocalPool( PoolEnum.SASL_AUTH_POJO_POOL,
-	                1024, 1024 );
-	        
-	        pools[PoolEnum.BIND_RESPONSE_POJO_POOL]      = new LocalPool(
-	                PoolEnum.BIND_RESPONSE_POJO_POOL, 1024, 1024 );
-	        
-	        pools[PoolEnum.BIND_REQUEST_POJO_POOL]       = new LocalPool(
-	                PoolEnum.BIND_REQUEST_POJO_POOL, 1024, 1024 );
-	
-	        pools[PoolEnum.LDAP_MESSAGE_CONTAINER_POOL] = new LocalPool(
-	                PoolEnum.LDAP_MESSAGE_CONTAINER_POOL, 1024, 1024 );
-	
-	        pools[PoolEnum.LDAP_MESSAGE_POJO_POOL] = new LocalPool(
-	                PoolEnum.LDAP_MESSAGE_POJO_POOL, 1024, 1024 );
-
-	        pools[PoolEnum.LDAP_RESULT_POJO_POOL] = new LocalPool(
-	                PoolEnum.LDAP_RESULT_POJO_POOL, 1024, 1024 );
-
-	        pools[PoolEnum.STRING_POOL_16] = new LocalPool(
-	                PoolEnum.STRING_POOL_16, 10240, 10240 );
-
-	        pools[PoolEnum.STRING_POOL_32] = new LocalPool(
-	                PoolEnum.STRING_POOL_32, 10240, 10240 );
-	        
-	        pools[PoolEnum.STRING_POOL_64] = new LocalPool(
-	                PoolEnum.STRING_POOL_64, 10240, 10240 );
-	        
-	        pools[PoolEnum.STRING_POOL_128] = new LocalPool(
-	                PoolEnum.STRING_POOL_128, 5120, 5120 );
-	        
-	        pools[PoolEnum.STRING_POOL_256] = new LocalPool(
-	                PoolEnum.STRING_POOL_256, 1024, 1024 );
-	        
-	        pools[PoolEnum.STRING_POOL_512] = new LocalPool(
-	                PoolEnum.STRING_POOL_512, 512, 512 );
-
-	        pools[PoolEnum.STRING_POOL_1024] = new LocalPool(
-	                PoolEnum.STRING_POOL_1024, 256, 256 );
-
-	        pools[PoolEnum.STREAMED_STRING_POOL] = new LocalPool(
-	                PoolEnum.STREAMED_STRING_POOL, 256, 256 );
+    	    pools = new LocalPool[nbPools];
+    	    GlobalPoolManager.initialize(nbPools);
     	}
     }
 
     //~ Methods ------------------------------------------------------------------------------------
+    
+    /**
+     * Initialize a new LocalPool object. We also have to initialize
+     * the associated global pool.
+     *
+     * @param poolId Identify the object's type that is stored in the pool.
+     * @param capacity Capacity of the pool
+     * @param increment Increment size of the pool
+    */
+    public void initPool(int poolId, ObjectFactory objectFactory, int capacity, int increment)
+    {
+        pools[poolId] = new LocalPool(poolId, capacity, increment);
+        
+        if (isPooled)
+        {
+            GlobalPoolManager.getInstance().initPool(poolId, objectFactory, capacity, increment
);
+        }
+    }
 
     /**
      * Allocate an object by asking its associated pool to deliver one.

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/PoolEnum.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/PoolEnum.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/PoolEnum.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/PoolEnum.java
Mon Apr 25 13:32:12 2005
@@ -16,14 +16,6 @@
  */
 package org.apache.asn1.util.pools;
 
-import org.apache.asn1.ber.tlv.TLV;
-import org.apache.asn1.ldap.codec.LdapMessageContainer;
-import org.apache.asn1.ldap.pojo.BindRequestPOJO;
-import org.apache.asn1.ldap.pojo.BindResponsePOJO;
-import org.apache.asn1.ldap.pojo.LdapMessagePOJO;
-import org.apache.asn1.ldap.pojo.LdapResultPOJO;
-import org.apache.asn1.ldap.pojo.SaslAuthenticationPOJO;
-import org.apache.asn1.ldap.pojo.SimpleAuthenticationPOJO;
 import org.apache.asn1.util.MutableString;
 
 /**
@@ -39,84 +31,29 @@
 {
     //~ Instance fields ----------------------------------------------------------------------------
 
-    /** Pool of tags */
-    public static int TAG_POOL = 0;
-
-    /** Pool of TLVs */
-    public static final int TLV_POOL = 0;
-
-    /** Pool of SimpleAuthPOJO objects */
-    public static final int SIMPLE_AUTH_POJO_POOL = 1;
-
-    /** Pool of SaslAuthPOJO objects */
-    public static final int SASL_AUTH_POJO_POOL = 2;
-
-    /** Pool of BindResponsePOJO objects */
-    public static final int BIND_RESPONSE_POJO_POOL = 3;
-
-    /** Pool of BindRequestPOJO objects */
-    public static final int BIND_REQUEST_POJO_POOL = 4;
-
-    /** Pool of LdapMessageContainer objects */
-    public static final int LDAP_MESSAGE_CONTAINER_POOL = 5;
-
-    /** Pool of LdapMessagePOJO objects */
-    public static final int LDAP_MESSAGE_POJO_POOL = 6;
-
-    /** Pool of Ldap Result POJO */
-    public static final int LDAP_RESULT_POJO_POOL = 7;
-
     /** Pool of 16 chars length Strings */
-    public static final int STRING_POOL_16 = 8;
+    public static final int STRING_POOL_16 = 0;
 
     /** Pool of 32 chars length Strings */
-    public static final int STRING_POOL_32 = 9;
+    public static final int STRING_POOL_32 = 1;
 
     /** Pool of 64 chars length Strings */
-    public static final int STRING_POOL_64 = 10;
+    public static final int STRING_POOL_64 = 2;
 
     /** Pool of 128 chars length Strings */
-    public static final int STRING_POOL_128 = 11;
+    public static final int STRING_POOL_128 = 3;
 
     /** Pool of 256 chars length Strings */
-    public static final int STRING_POOL_256 = 12;
+    public static final int STRING_POOL_256 = 4;
 
     /** Pool of 512 chars length Strings */
-    public static final int STRING_POOL_512 = 13;
+    public static final int STRING_POOL_512 = 5;
 
     /** Pool of 1024 chars length Strings */
-    public static final int STRING_POOL_1024 = 14;
+    public static final int STRING_POOL_1024 = 6;
 
     /** Pool of streamed Strings */
-    public static final int STREAMED_STRING_POOL = 15;
-
-    /** To add a new pool type, change the static name.
-     * Don't forget to add a String in poolStrings !  */
-    // public static final int <ADDED_POOL> = <last pool number + 1>;
-
-    /** The maximum number of pool we could have */
-    public static final int POOL_NUMBER = 16;
-    
-    /** The string representation for debuging purpose */
-    private static final String[] poolStrings = new String[]{
-            "TLV",
-            "SimpleAuthPOJO",
-            "SaslAuthPOJO",
-            "BindResponsePOJO",
-            "BindRequestPOJO",
-            "LdapMessageContainer",
-            "LdapMessagePOJO",
-            "LdapResultPOJO",
-            "String16",
-            "String32",
-            "String64",
-            "String128",
-            "String256",
-            "String512",
-            "String1024",
-            "StreamedString"
-			// Add a new pool right here
-    };
+    public static final int STREAMED_STRING_POOL = 7;
 
     /**
      * Get the name of the object stored in this pool 
@@ -126,14 +63,18 @@
     public static String getType(int poolId)
     {
 
-    	if ((poolId > 0) && (poolId < poolStrings.length)) 
-    	{
-    		return poolStrings[poolId];
+        switch (poolId)
+        {
+        	case STRING_POOL_16       : return "String16";
+        	case STRING_POOL_32       : return "String32";
+        	case STRING_POOL_64       : return "String64";
+        	case STRING_POOL_128      : return "String128";
+        	case STRING_POOL_256      : return "String256";
+        	case STRING_POOL_512      : return "String512";
+        	case STRING_POOL_1024     : return "String1024";
+        	case STREAMED_STRING_POOL : return "StreamedString";
+        	default                   : return "UNKNOWN POOL";
         }
-    	else
-    	{
-    		return "UNKNOWN POOL";
-    	}
     }
     
     /**
@@ -145,14 +86,14 @@
     {
     	switch (poolId)
 		{
-    		case TLV_POOL : return new TLV();
-    		case SIMPLE_AUTH_POJO_POOL : return new SimpleAuthenticationPOJO();
-    		case SASL_AUTH_POJO_POOL : return new SaslAuthenticationPOJO();
-    		case BIND_RESPONSE_POJO_POOL : return new BindResponsePOJO();
-    		case BIND_REQUEST_POJO_POOL : return new BindRequestPOJO();
-    		case LDAP_MESSAGE_CONTAINER_POOL : return new LdapMessageContainer();
-    		case LDAP_MESSAGE_POJO_POOL : return new LdapMessagePOJO();
-    		case LDAP_RESULT_POJO_POOL : return new LdapResultPOJO();
+	    	case STRING_POOL_16       : return new MutableString(16);
+	    	case STRING_POOL_32       : return new MutableString(32);
+	    	case STRING_POOL_64       : return new MutableString(64);
+	    	case STRING_POOL_128      : return new MutableString(128);
+	    	case STRING_POOL_256      : return new MutableString(256);
+	    	case STRING_POOL_512      : return new MutableString(512);
+	    	case STRING_POOL_1024     : return new MutableString(1024);
+	    	case STREAMED_STRING_POOL : return new MutableString();
     		
     		default : return null;
 		}

Modified: directory/sandbox/trunk/asn1-new-codec/src/perfs/org/apache/ans1/ber/LdapDecoderPerf.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/perfs/org/apache/ans1/ber/LdapDecoderPerf.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/perfs/org/apache/ans1/ber/LdapDecoderPerf.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/perfs/org/apache/ans1/ber/LdapDecoderPerf.java
Mon Apr 25 13:32:12 2005
@@ -19,11 +19,12 @@
 import org.apache.asn1.DecoderException;
 import org.apache.asn1.ber.Asn1Decoder;
 import org.apache.asn1.ber.containers.IAsn1Container;
+import org.apache.asn1.ldap.codec.LdapDecoder;
 import org.apache.asn1.ldap.codec.LdapMessageContainer;
+import org.apache.asn1.ldap.codec.LdapPoolEnum;
 import org.apache.asn1.ldap.pojo.BindRequestPOJO;
 import org.apache.asn1.ldap.pojo.LdapMessagePOJO;
 import org.apache.asn1.ldap.pojo.SimpleAuthenticationPOJO;
-import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.asn1.util.pools.PoolException;
 
 import org.apache.log4j.Logger;
@@ -56,7 +57,7 @@
      */
     public void run()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
         
         ByteBuffer  stream      = ByteBuffer.allocate( 0x35 );
         stream.put(
@@ -92,7 +93,7 @@
                 try
                 {
                     ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                            PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                            LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
                 }
                 catch ( PoolException pe )
                 {
@@ -125,7 +126,7 @@
         {
 
             IAsn1Container ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
             ldapMessageContainer.setPoolManager( ldapDecoder.getPoolManager() );
 
             ldapDecoder.decode( stream, ldapMessageContainer );

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindRequestTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindRequestTest.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindRequestTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindRequestTest.java
Mon Apr 25 13:32:12 2005
@@ -25,7 +25,6 @@
 import org.apache.asn1.ldap.pojo.LdapMessagePOJO;
 import org.apache.asn1.ldap.pojo.SaslAuthenticationPOJO;
 import org.apache.asn1.ldap.pojo.SimpleAuthenticationPOJO;
-import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.asn1.util.pools.PoolException;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
@@ -51,7 +50,7 @@
      */
     public void testDecodeBindRequestSimpleNoControls()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x35 );
         stream.put(
@@ -78,7 +77,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {
@@ -117,7 +116,7 @@
      */
     public void testDecodeBindRequestNoName()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x15 );
         stream.put(
@@ -141,7 +140,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {
@@ -169,7 +168,7 @@
      */
     public void testDecodeBindRequestSaslNoCredsNoControls()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x38 );
         stream.put(
@@ -199,7 +198,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {
@@ -238,7 +237,7 @@
      */
     public void testDecodeBindRequestSaslCredsNoControls()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x41 );
         stream.put(
@@ -273,7 +272,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindResponseTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindResponseTest.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindResponseTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/BindResponseTest.java
Mon Apr 25 13:32:12 2005
@@ -23,7 +23,6 @@
 import org.apache.asn1.ber.containers.IAsn1Container;
 import org.apache.asn1.ldap.pojo.BindResponsePOJO;
 import org.apache.asn1.ldap.pojo.LdapMessagePOJO;
-import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.asn1.util.pools.PoolException;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
@@ -48,7 +47,7 @@
      */
     public void testDecodeBindResponseSuccess()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x2D );
         
@@ -80,7 +79,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/LdapDecoderTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/LdapDecoderTest.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/LdapDecoderTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/LdapDecoderTest.java
Mon Apr 25 13:32:12 2005
@@ -24,7 +24,6 @@
 import org.apache.asn1.ldap.pojo.BindRequestPOJO;
 import org.apache.asn1.ldap.pojo.LdapMessagePOJO;
 import org.apache.asn1.ldap.pojo.SimpleAuthenticationPOJO;
-import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.asn1.util.pools.PoolException;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
@@ -50,7 +49,7 @@
      */
     public void testDecodeFull()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x35 );
         stream.put(
@@ -77,7 +76,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {
@@ -115,7 +114,7 @@
      */
     public void testDecodePartial()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 16 );
         stream.put(
@@ -138,7 +137,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {
@@ -175,7 +174,7 @@
      */
     public void testDecodeSplittedPDU()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 16 );
         stream.put(
@@ -198,7 +197,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {
@@ -262,7 +261,7 @@
      */
     public void testDecodeBadLengthTooSmall()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x35 );
         stream.put(
@@ -290,7 +289,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {
@@ -318,7 +317,7 @@
      */
     public void testDecodeBadPrimitiveLengthTooBig()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x35 );
         stream.put(
@@ -346,7 +345,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {
@@ -374,7 +373,7 @@
      */
     public void testDecodeBadTagTransition()
     {
-        Asn1Decoder ldapDecoder = new Asn1Decoder();
+        Asn1Decoder ldapDecoder = new LdapDecoder();
 
         ByteBuffer  stream      = ByteBuffer.allocate( 0x35 );
         stream.put(
@@ -402,7 +401,7 @@
         try
         {
             ldapMessageContainer = ( IAsn1Container ) ldapDecoder.allocate(
-                    PoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
+                    LdapPoolEnum.LDAP_MESSAGE_CONTAINER_POOL );
         }
         catch ( PoolException pe )
         {

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java?rev=164638&r1=164637&r2=164638&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
Mon Apr 25 13:32:12 2005
@@ -21,8 +21,16 @@
 
 import org.apache.asn1.DecoderException;
 import org.apache.asn1.ldap.codec.primitives.LdapDN;
+import org.apache.asn1.util.MutableString1024Factory;
+import org.apache.asn1.util.MutableString128Factory;
+import org.apache.asn1.util.MutableString16Factory;
+import org.apache.asn1.util.MutableString256Factory;
+import org.apache.asn1.util.MutableString32Factory;
+import org.apache.asn1.util.MutableString512Factory;
+import org.apache.asn1.util.MutableString64Factory;
+import org.apache.asn1.util.MutableStringFactory;
 import org.apache.asn1.util.pools.LocalPoolManager;
-import org.apache.asn1.util.pools.PoolManager;
+import org.apache.asn1.util.pools.PoolEnum;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 
@@ -44,7 +52,7 @@
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** The logger */
-    private PoolManager poolMgr;
+    private LocalPoolManager poolMgr;
 
     //~ Methods ------------------------------------------------------------------------------------
 
@@ -53,7 +61,18 @@
      */
     protected void setUp()
     {
-        poolMgr = new LocalPoolManager( true );
+        // We have to create the pools, which are MutableString
+        // pools. We will initialize 8 pools.
+        poolMgr = new LocalPoolManager( 60, true );
+        
+        poolMgr.initPool(PoolEnum.STRING_POOL_16, new MutableString16Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_32, new MutableString32Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_64, new MutableString64Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_128, new MutableString128Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_256, new MutableString256Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_512, new MutableString512Factory(), 1024, 1024);
+        poolMgr.initPool(PoolEnum.STRING_POOL_1024, new MutableString1024Factory(), 1024,
1024);
+        poolMgr.initPool(PoolEnum.STREAMED_STRING_POOL, new MutableStringFactory(), 1024,
1024);
     }
 
     /**



Mime
View raw message