Class 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 for StringBuilder.
    Author:
    kong
    • 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 null
      java.lang.StringBuilder get()
      Retrieves an element in the current pool
      static StringBuilderPool getInstance()  
      int getPoolSize()
      Retrieves the pool size
      void repay​(java.lang.StringBuilder element)
      When you finished using an element, repay (free) it for the reusing
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringBuilderPool

        public StringBuilderPool()
    • Method Detail

      • get

        public java.lang.StringBuilder get()
        Description copied from interface: IElementPool
        Retrieves an element in the current pool
        Specified by:
        get in interface IElementPool<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 interface IElementPool<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 interface IElementPool<java.lang.StringBuilder>
      • getPoolSize

        public int getPoolSize()
        Description copied from interface: IElementPool
        Retrieves the pool size
        Specified by:
        getPoolSize in interface IElementPool<java.lang.StringBuilder>
        Returns:
        the total number of element or -1 if any exceptions caused