com.sapportals.portal.prt.util
Class StringBufferPool

java.lang.Object
  |
  +--com.sapportals.portal.prt.util.AbstractPool
        |
        +--com.sapportals.portal.prt.util.StringBufferPool

public class StringBufferPool
extends AbstractPool

StringBufferPool.java Created: Wed Jun 27 10:52:51 2001

Version:
$Revision: #3 $
$File:$ , $Revision:$ Last modified on $Date:$ by $Author:$ using $Change:$ Copyright (c) SAP Portals Europe GmbH 2001

Field Summary
protected static java.lang.String DEFAULT_POOL_NAME
           
protected static StringBufferPool m_corePoolFactory
           
protected static java.util.HashMap mm_namedPools
           
protected  java.lang.String mm_poolName
           
protected static int STRINGBUFFER_INITIALCAPACITY
           
protected static int STRINGBUFFER_INITIALNBINSTANCES
           
protected static int STRINGBUFFER_MAX_POOLSIZE
           
 
Fields inherited from class com.sapportals.portal.prt.util.AbstractPool
mm_maxPoolSize, mm_unlocked
 
Constructor Summary
protected StringBufferPool(int initialCapacity, int initialNbInstances, int maxSize)
           
 
Method Summary
static StringBufferPool createInstance(java.lang.String poolName, int intialCapacity)
          Creates a pool and bind to the name specified by the poolName argument.
static StringBufferPool createInstance(java.lang.String poolName, int intialCapacity, int initialNbInstances)
          Creates a pool and bind to the name specified by the poolName argument.
static StringBufferPool createInstance(java.lang.String poolName, int intialCapacity, int initialNbInstances, int maxPoolSize)
          Creates a pool and bind to the name specified by the poolName argument.
protected  StringBufferPool createInstanceInternal(java.lang.String poolName, int intialCapacity)
          Creates a pool and bind to the name specified by the poolName argument.
protected  StringBufferPool createInstanceInternal(java.lang.String poolName, int intialCapacity, int initialNbInstances)
          Creates a pool and bind to the name specified by the poolName argument.
protected  StringBufferPool createInstanceInternal(java.lang.String poolName, int intialCapacity, int initialNbInstances, int maxPoolSize)
          Creates a pool and bind to the name specified by the poolName argument.
protected  java.lang.Object createPoolObject()
          Factory method to create pool objects
static void deleteInstance(java.lang.String poolName)
           
protected static void ensureInitialized()
           
protected  void expirePoolObject(java.lang.Object o)
          Callback when object are not managed anymore by the pool.
 RecyclableStringBuffer get(int size)
          Returns the
static StringBufferPool getInstance()
          Gets the StringBufferPool instance.
static StringBufferPool getInstance(java.lang.String poolName)
          Gets a StringBufferPool specified by the poolName argument.
protected  StringBufferPool getInstanceInternal()
          Gets the StringBufferPool instance.
protected  StringBufferPool getInstanceInternal(java.lang.String poolName)
          Gets a StringBufferPool specified by the poolName argument.
 void release(RecyclableStringBuffer rStrBuf)
           
protected  boolean validatePoolObject(java.lang.Object o)
          Method called to validate an object that has been put back in the pool
 
Methods inherited from class com.sapportals.portal.prt.util.AbstractPool
getPoolObject, releasePoolObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_corePoolFactory

protected static StringBufferPool m_corePoolFactory

mm_namedPools

protected static java.util.HashMap mm_namedPools

DEFAULT_POOL_NAME

protected static final java.lang.String DEFAULT_POOL_NAME

STRINGBUFFER_INITIALCAPACITY

protected static final int STRINGBUFFER_INITIALCAPACITY

STRINGBUFFER_INITIALNBINSTANCES

protected static final int STRINGBUFFER_INITIALNBINSTANCES

STRINGBUFFER_MAX_POOLSIZE

protected static final int STRINGBUFFER_MAX_POOLSIZE

mm_poolName

protected java.lang.String mm_poolName
Constructor Detail

StringBufferPool

protected StringBufferPool(int initialCapacity,
                           int initialNbInstances,
                           int maxSize)
Method Detail

getInstance

public static StringBufferPool getInstance()
Gets the StringBufferPool instance. Note that this instance can be shared among all portal processes and applications. Returns the StringBufferPool instance.

ensureInitialized

protected static void ensureInitialized()

getInstance

public static StringBufferPool getInstance(java.lang.String poolName)
Gets a StringBufferPool specified by the poolName argument. This will eventually create the corresponding pool using default capacity and max size values. But a client should typically create its own pool using the createInstance method first and use the getInstance afterwards. Returns a StringBufferPool instance

createInstance

public static StringBufferPool createInstance(java.lang.String poolName,
                                              int intialCapacity)
Creates a pool and bind to the name specified by the poolName argument. If the pool already exists the method simply returns the previous instance ignoring the initial capacity argument. Returns a StringBufferPool instance

createInstance

public static StringBufferPool createInstance(java.lang.String poolName,
                                              int intialCapacity,
                                              int initialNbInstances)
Creates a pool and bind to the name specified by the poolName argument. If the pool already exists the method simply returns the previous instance ignoring the all additional arguments. Returns a StringBufferPool instance

createInstance

public static StringBufferPool createInstance(java.lang.String poolName,
                                              int intialCapacity,
                                              int initialNbInstances,
                                              int maxPoolSize)
Creates a pool and bind to the name specified by the poolName argument. If the pool already exists the method simply returns the previous instance ignoring the all additional arguments. Returns a StringBufferPool instance

deleteInstance

public static void deleteInstance(java.lang.String poolName)

validatePoolObject

protected boolean validatePoolObject(java.lang.Object o)
Description copied from class: AbstractPool
Method called to validate an object that has been put back in the pool
Overrides:
validatePoolObject in class AbstractPool
Parameters:
o -  

createPoolObject

protected java.lang.Object createPoolObject()
                                     throws java.lang.Exception
Description copied from class: AbstractPool
Factory method to create pool objects
Overrides:
createPoolObject in class AbstractPool
Throws:
java.lang.Exception -  

expirePoolObject

protected void expirePoolObject(java.lang.Object o)
Description copied from class: AbstractPool
Callback when object are not managed anymore by the pool.
Overrides:
expirePoolObject in class AbstractPool
Parameters:
o -  

get

public RecyclableStringBuffer get(int size)
Returns the
Parameters:
size -  

release

public void release(RecyclableStringBuffer rStrBuf)
Parameters:
rStrBuf -  

createInstanceInternal

protected StringBufferPool createInstanceInternal(java.lang.String poolName,
                                                  int intialCapacity)
Creates a pool and bind to the name specified by the poolName argument. If the pool already exists the method simply returns the previous instance ignoring the initial capacity argument. Returns a StringBufferPool instance

createInstanceInternal

protected StringBufferPool createInstanceInternal(java.lang.String poolName,
                                                  int intialCapacity,
                                                  int initialNbInstances)
Creates a pool and bind to the name specified by the poolName argument. If the pool already exists the method simply returns the previous instance ignoring the all additional arguments. Returns a StringBufferPool instance

createInstanceInternal

protected StringBufferPool createInstanceInternal(java.lang.String poolName,
                                                  int intialCapacity,
                                                  int initialNbInstances,
                                                  int maxPoolSize)
Creates a pool and bind to the name specified by the poolName argument. If the pool already exists the method simply returns the previous instance ignoring the all additional arguments. Returns a StringBufferPool instance

getInstanceInternal

protected StringBufferPool getInstanceInternal()
Gets the StringBufferPool instance. Note that this instance can be shared among all portal processes and applications. Returns the StringBufferPool instance.

getInstanceInternal

protected StringBufferPool getInstanceInternal(java.lang.String poolName)
Gets a StringBufferPool specified by the poolName argument. This will eventually create the corresponding pool using default capacity and max size values. But a client should typically create its own pool using the createInstance method first and use the getInstance afterwards. Returns a StringBufferPool instance