Package com.tenio.logger.pool
Class StringBuilderPool
- java.lang.Object
-
- com.tenio.logger.pool.StringBuilderPool
-
- All Implemented Interfaces:
IElementPool<java.lang.StringBuilder>
public final class StringBuilderPool extends java.lang.Object implements IElementPool<java.lang.StringBuilder>
The object pool mechanism forStringBuilder
.- Author:
- kong
-
-
Constructor Summary
Constructors Constructor Description StringBuilderPool()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup()
Clean up, after that all arrays will be set to nulljava.lang.StringBuilder
get()
Retrieves an element in the current poolstatic StringBuilderPool
getInstance()
int
getPoolSize()
Retrieves the pool sizevoid
repay(java.lang.StringBuilder element)
When you finished using an element, repay (free) it for the reusing
-
-
-
Method Detail
-
getInstance
public static StringBuilderPool getInstance()
-
get
public java.lang.StringBuilder get()
Description copied from interface:IElementPool
Retrieves an element in the current pool- Specified by:
get
in interfaceIElementPool<java.lang.StringBuilder>
- Returns:
- an element in the pool
-
repay
public void repay(java.lang.StringBuilder element)
Description copied from interface:IElementPool
When you finished using an element, repay (free) it for the reusing- Specified by:
repay
in interfaceIElementPool<java.lang.StringBuilder>
- Parameters:
element
- the finished using element
-
cleanup
public void cleanup()
Description copied from interface:IElementPool
Clean up, after that all arrays will be set to null- Specified by:
cleanup
in interfaceIElementPool<java.lang.StringBuilder>
-
getPoolSize
public int getPoolSize()
Description copied from interface:IElementPool
Retrieves the pool size- Specified by:
getPoolSize
in interfaceIElementPool<java.lang.StringBuilder>
- Returns:
- the total number of element or -1 if any exceptions caused
-
-