com.mongodb.util
Class StringBuilderPool
java.lang.Object
com.mongodb.util.SimplePool<StringBuilder>
com.mongodb.util.StringBuilderPool
public class StringBuilderPool
- extends SimplePool<StringBuilder>
Constructor Summary |
StringBuilderPool(String name,
int maxToKeep)
Initializes a pool of a given number of StringBuilders, each of a certain size. |
Methods inherited from class com.mongodb.util.SimplePool |
cleanup, close, done, get, get, getAvailable, getInUse, getMaxSize, getName, getTotal, pick, remove, toString |
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
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)