Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 33417 invoked from network); 3 Apr 2005 17:54:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Apr 2005 17:54:53 -0000 Received: (qmail 75330 invoked by uid 500); 3 Apr 2005 17:54:53 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 75277 invoked by uid 500); 3 Apr 2005 17:54:52 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 75264 invoked by uid 99); 3 Apr 2005 17:54:52 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sun, 03 Apr 2005 10:54:52 -0700 Received: (qmail 33396 invoked by uid 65534); 3 Apr 2005 17:54:51 -0000 Message-ID: <20050403175451.33395.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Sun, 03 Apr 2005 17:54:51 -0000 Subject: svn commit: r159943 - directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/pools/PoolEnum.java To: commits@directory.apache.org From: elecharny@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: elecharny Date: Sun Apr 3 10:54:50 2005 New Revision: 159943 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D159943 Log: Extended the Pools by adding MutableString pools. Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/po= ols/PoolEnum.java Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/u= til/pools/PoolEnum.java URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/s= rc/java/org/apache/asn1/util/pools/PoolEnum.java?view=3Ddiff&r1=3D159942&r2= =3D159943 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/po= ols/PoolEnum.java (original) +++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/po= ols/PoolEnum.java Sun Apr 3 10:54:50 2005 @@ -23,6 +23,7 @@ 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.MutableString; =20 /** * This is where all the different pools are named. To add a new pool, we = have to @@ -37,30 +38,54 @@ { //~ Instance fields --------------------------------------------------= -------------------------- =20 - /** IPool of tags */ + /** Pool of tags */ public static int TAG_POOL =3D 0; =20 - /** IPool of TLVs */ + /** Pool of TLVs */ public static final int TLV_POOL =3D TAG_POOL++; =20 - /** IPool of SimpleAuthPOJO objects */ + /** Pool of SimpleAuthPOJO objects */ public static final int SIMPLE_AUTH_POJO_POOL =3D TAG_POOL++; =20 - /** IPool of SaslAuthPOJO objects */ + /** Pool of SaslAuthPOJO objects */ public static final int SASL_AUTH_POJO_POOL =3D TAG_POOL++; =20 - /** IPool of BindResponsePOJO objects */ + /** Pool of BindResponsePOJO objects */ public static final int BIND_RESPONSE_POJO_POOL =3D TAG_POOL++; =20 - /** IPool of BindRequestPOJO objects */ + /** Pool of BindRequestPOJO objects */ public static final int BIND_REQUEST_POJO_POOL =3D TAG_POOL++; =20 - /** IPool of LdapMessageContainer objects */ + /** Pool of LdapMessageContainer objects */ public static final int LDAP_MESSAGE_CONTAINER_POOL =3D TAG_POOL++; =20 - /** IPool of LdapMessagePOJO objects */ + /** Pool of LdapMessagePOJO objects */ public static final int LDAP_MESSAGE_POJO_POOL =3D TAG_POOL++; =20 + /** Pool of 16 chars length Strings */ + public static final int STRING_POOL_16 =3D TAG_POOL++; + + /** Pool of 32 chars length Strings */ + public static final int STRING_POOL_32 =3D TAG_POOL++; + + /** Pool of 64 chars length Strings */ + public static final int STRING_POOL_64 =3D TAG_POOL++; + + /** Pool of 128 chars length Strings */ + public static final int STRING_POOL_128 =3D TAG_POOL++; + + /** Pool of 256 chars length Strings */ + public static final int STRING_POOL_256 =3D TAG_POOL++; + + /** Pool of 512 chars length Strings */ + public static final int STRING_POOL_512 =3D TAG_POOL++; + + /** Pool of 1024 chars length Strings */ + public static final int STRING_POOL_1024 =3D TAG_POOL++; + + /** Pool of streamed Strings */ + public static final int STREAMED_STRING_POOL =3D TAG_POOL++; + /** To add a new pool type, change the static name. * Don't forget to add a String in poolStrings ! */ // public static final int =3D TAG_POOL++; @@ -68,6 +93,7 @@ /** The maximum number of pool we could have */ public static final int POOL_NUMBER =3D TAG_POOL; =20 + /** The string representation for debuging purpose */ private static final String[] poolStrings =3D new String[]{ "TLV", "SimpleAuthPOJO", @@ -75,7 +101,15 @@ "BindResponsePOJO", "BindRequestPOJO", "LdapMessageContainer", - "LdapMessagePOJO" + "LdapMessagePOJO", + "String16", + "String32", + "String64", + "String128", + "String256", + "String512", + "String1024", + "StreamedString" // Add a new pool right here }; =20 @@ -116,5 +150,22 @@ =09 default : return null; } + } + + /** + * Allocate a new object from a sized pool (used for strings). + * @param poolId The object pool Id + * @return An object + */ + public static PoolObject allocateString( int size ) + { + if (size > 1024) + { + return new MutableString( size, MutableString.STREAMED); + } + else + { + return new MutableString( ( ( size >> 4 ) + ( ( size & 0x0F ) = !=3D 0 ? 1 : 0) ) << 4 ); + } } }