com.mongodb.util
Class StringBuilderPool

java.lang.Object
  extended by com.mongodb.util.SimplePool<StringBuilder>
      extended by com.mongodb.util.StringBuilderPool

public class StringBuilderPool
extends SimplePool<StringBuilder>


Field Summary
 
Fields inherited from class com.mongodb.util.SimplePool
_avail, _name, _out, _size
 
Constructor Summary
StringBuilderPool(String name, int maxToKeep)
          Initializes a pool of a given number of StringBuilders, each of a certain size.
 
Method Summary
 StringBuilder createNew()
          Create a new string builder.
protected  long memSize(StringBuilder buf)
           
 boolean ok(StringBuilder buf)
          Checks that the given string builder is within the size limit.
 
Methods inherited from class com.mongodb.util.SimplePool
cleanup, close, done, get, get, getAvailable, getInUse, getMaxSize, getName, getTotal, pick, remove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringBuilderPool

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

Parameters:
maxToKeep - the number of string builders in the pool
Method Detail

createNew

public StringBuilder createNew()
Create a new string builder.

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

ok

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

Parameters:
buf - the builder to check
Returns:
if it is not too big

memSize

protected long memSize(StringBuilder buf)