Interface ReferenceCounted

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int refCnt()
      Returns the reference count of this object.
      boolean release()
      Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
      boolean release​(int decrement)
      Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
      ReferenceCounted retain()
      Increases the reference count by 1.
      ReferenceCounted retain​(int increment)
      Increases the reference count by the specified increment.
      ReferenceCounted touch()
      Records the current access location of this object for debugging purposes.
      ReferenceCounted touch​(Object hint)
      Records the current access location of this object with an additional arbitrary information for debugging purposes.
    • Method Detail

      • refCnt

        int refCnt()
        Returns the reference count of this object. If 0, it means this object has been deallocated.
      • retain

        ReferenceCounted retain​(int increment)
        Increases the reference count by the specified increment.
      • touch

        ReferenceCounted touch()
        Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector. This method is a shortcut to touch(null).
      • touch

        ReferenceCounted touch​(Object hint)
        Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector.
      • release

        boolean release()
        Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
        Returns:
        true if and only if the reference count became 0 and this object has been deallocated
      • release

        boolean release​(int decrement)
        Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
        Returns:
        true if and only if the reference count became 0 and this object has been deallocated