-
public interface RefCountedAn interface for reference-counted objects. Can be used with RCPointer by delegation.
-
-
Method Summary
Modifier and Type Method Description abstract Unitacquire(String source)Acquire a reference. abstract Unitrelease(String source, String reason)Release a reference. abstract IntegergetRefCount()The current reference count. abstract BooleangetIsDisposed()Whether this object has been disposed due to the reference count reaching 0. -
-
Method Detail
-
acquire
abstract Unit acquire(String source)
Acquire a reference. Must be balanced with a call to release.
- Parameters:
source- A string indicating the source of the acquisition, for logging purposes, e.g.
-
release
abstract Unit release(String source, String reason)
Release a reference. When the last reference is released, the object is disposed.
- Parameters:
source- A string indicating the source of the acquisition, for logging purposes, e.g.reason- An optional string indicating the reason for the release, for logging purposes.
-
getRefCount
abstract Integer getRefCount()
The current reference count.
-
getIsDisposed
abstract Boolean getIsDisposed()
Whether this object has been disposed due to the reference count reaching 0.
-
-
-
-