Interface RecyclableInterface<R extends RecyclableInterface<R,​P>,​P extends RecyclerRequestInterface>

  • Type Parameters:
    R - Recyclable type
    P - Request type
    All Superinterfaces:
    Freeable, SizedInBytes

    public interface RecyclableInterface<R extends RecyclableInterface<R,​P>,​P extends RecyclerRequestInterface>
    extends SizedInBytes, Freeable
    Interface for all recyclable objects. A recyclable object life-cycle is handled by the recycling machinery. Recyclable objects are expensive to Instantiate and/or garbage collect and thus are reused when possible to reduce resource pressure on the system.
    Author:
    royer
    • Method Detail

      • isCompatible

        boolean isCompatible​(P pRequest)
        Returns true if this object is compatible with the given request. Compatibility means that the object can be reused as well as an object newly instantiated with the given request.
        Parameters:
        pRequest - request
        Returns:
        true if compatible
      • recycle

        void recycle​(P pRequest)
        Recycles the object by initializing this object with information from the given request
        Parameters:
        pRequest - request
      • setRecycler

        void setRecycler​(RecyclerInterface<R,​P> pRecycler)
        Sets the recycler that should be used by this recyclable object
        Parameters:
        pRecycler - recycler to use
      • setReleased

        void setReleased​(boolean pIsReleased)
        Sets whether this recyclable object has been released. An object is released when it is not in use anymore and is waiting to be recycled.
        Parameters:
        pIsReleased - ?
      • isReleased

        boolean isReleased()
        Returns true if the object has been released. An object is released when it is not in use anymore and is waiting to be recycled.
        Returns:
        true if released
      • release

        void release()
        Release this object. An object is released when it is not in use anymore and is waiting to be recycled.