com.mongodb.util
Class StringBuilderPool

java.lang.Object
  extended by com.mongodb.util.SimplePool<java.lang.StringBuilder>
      extended by com.mongodb.util.StringBuilderPool
All Implemented Interfaces:
javax.management.DynamicMBean

public class StringBuilderPool
extends SimplePool<java.lang.StringBuilder>


Field Summary
 
Fields inherited from class com.mongodb.util.SimplePool
_availSafe, _debug, _maxToKeep, _maxTotal, _name, _trackLeaks
 
Constructor Summary
StringBuilderPool(java.lang.String name, int maxToKeep, int maxSize)
          Initializes a pool of a given number of StringBuilders, each of a certain size.
 
Method Summary
 java.lang.StringBuilder createNew()
          Create a new string builder.
protected  long memSize(java.lang.StringBuilder buf)
           
 boolean ok(java.lang.StringBuilder buf)
          Checks that the given string builder is within the size limit.
 
Methods inherited from class com.mongodb.util.SimplePool
available, cleanup, clear, done, everCreated, get, get, getAll, getAttribute, getAttributes, getMBeanInfo, inUse, invoke, maxToKeep, pick, remove, setAttribute, setAttributes, toString, total
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringBuilderPool

public StringBuilderPool(java.lang.String name,
                         int maxToKeep,
                         int maxSize)
Initializes a pool of a given number of StringBuilders, each of a certain size.

Parameters:
maxToKeep - the number of string builders in the pool
maxSize - the size of each string builder
Method Detail

createNew

public java.lang.StringBuilder createNew()
Create a new string builder.

Specified by:
createNew in class SimplePool<java.lang.StringBuilder>
Returns:
the string builder

ok

public boolean ok(java.lang.StringBuilder buf)
Checks that the given string builder is within the size limit.

Overrides:
ok in class SimplePool<java.lang.StringBuilder>
Parameters:
buf - the builder to check
Returns:
if it is not too big

memSize

protected long memSize(java.lang.StringBuilder buf)