com.mongodb.util
Class StringBuilderPool
java.lang.Object
com.mongodb.util.SimplePool<StringBuilder>
com.mongodb.util.StringBuilderPool
- All Implemented Interfaces:
- DynamicMBean
public class StringBuilderPool
- extends SimplePool<StringBuilder>
Constructor Summary |
StringBuilderPool(String name,
int maxToKeep,
int maxSize)
Initializes a pool of a given number of StringBuilders, each of a certain size. |
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 |
StringBuilderPool
public StringBuilderPool(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 poolmaxSize
- the size of each string builder
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.
- Overrides:
ok
in class SimplePool<StringBuilder>
- Parameters:
buf
- the builder to check
- Returns:
- if it is not too big
memSize
protected long memSize(StringBuilder buf)