|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.utils.StringBufferPool
public class StringBufferPool
This is a static utility class representing the StringBuffer, pool. StringBuffer objects can be retrieved from the pool and released back to the pool when necessary. This class must to be used anywhere where String concatenation operations are intensively performed to avoid too many objects being generated and GC slowing down the performance.
Field Summary | |
---|---|
private static java.util.ArrayList<java.lang.StringBuffer> |
free
The list of free StringBuffers. |
private static java.lang.Object |
mutex
Synchronization. |
Constructor Summary | |
---|---|
private |
StringBufferPool()
The constructor. |
Method Summary | |
---|---|
private static java.lang.StringBuffer |
allocStringBuffer()
|
private static java.lang.StringBuffer |
allocStringBuffer(java.lang.String str)
|
private static java.lang.StringBuffer |
getFreeStringBuffer()
|
static java.lang.StringBuffer |
getStringBuffer()
This method returns a StringBuffer object from the pool... |
static java.lang.StringBuffer |
getStringBuffer(java.lang.String str)
This method returns a StringBuffer object from the pool... |
static void |
releaseStringBuffer(java.lang.StringBuffer sb)
This method calls releases the provided StringBuffer to the pool... |
static java.lang.String |
toStringThenRelease(java.lang.StringBuffer sb)
This method calls toString() method on the provided StringBuffer object and releases it to the pool... |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.lang.Object mutex
private static java.util.ArrayList<java.lang.StringBuffer> free
Constructor Detail |
---|
private StringBufferPool()
Method Detail |
---|
private static java.lang.StringBuffer allocStringBuffer(java.lang.String str)
private static java.lang.StringBuffer allocStringBuffer()
private static java.lang.StringBuffer getFreeStringBuffer()
public static java.lang.StringBuffer getStringBuffer(java.lang.String str)
str
- String - the string to initialize the StringBuffer with.
public static java.lang.StringBuffer getStringBuffer()
public static void releaseStringBuffer(java.lang.StringBuffer sb)
sb
- StringBuffer - the StringBuffer to be released.public static java.lang.String toStringThenRelease(java.lang.StringBuffer sb)
sb
- StringBuffer - the StringBuffer to be released.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc