Package io.atomix.utils.concurrent
Interface ReferenceCounted<T>
-
- All Superinterfaces:
AutoCloseable
public interface ReferenceCounted<T> extends AutoCloseable
Reference counting interface.Types that implement
ReferenceCountedcan be counted for references and thus used to clean up resources once a given instance of an object is no longer in use.- Author:
- Jordan Halterman
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tacquire()Acquires a reference.voidclose()Defines an exception free close implementation.intreferences()Returns the number of open references.booleanrelease()Releases a reference.
-
-
-
Method Detail
-
acquire
T acquire()
Acquires a reference.- Returns:
- The acquired reference.
-
release
boolean release()
Releases a reference.- Returns:
- Indicates whether all references to the object have been released.
-
references
int references()
Returns the number of open references.- Returns:
- The number of open references.
-
close
void close()
Defines an exception free close implementation.- Specified by:
closein interfaceAutoCloseable
-
-