Class ReferenceCountingCloseableObject<BaseObject extends Closeable>

    • Constructor Detail

      • ReferenceCountingCloseableObject

        public ReferenceCountingCloseableObject​(BaseObject object)
    • Method Detail

      • getNumReferences

        public int getNumReferences()
      • isClosed

        public boolean isClosed()
      • increment

        public boolean increment()
        Increment the reference count by one.
      • decrement

        public void decrement()
        Decrement the reference count by one.
      • decrementOnceCloseable

        public Closeable decrementOnceCloseable()
        Returns a Closeable which action is to call decrement() only once. If close() is called on the returned Closeable object for the second time, it won't call decrement() again.