Package org.apache.druid.segment
Interface ReferenceCountedObject
-
- All Known Subinterfaces:
IndexedTable,Joinable,SegmentReference
- All Known Implementing Classes:
BroadcastSegmentIndexedTable,FilteredSegment,FrameBasedIndexedTable,HashJoinSegment,IndexedTableJoinable,JoinableClause,LookupJoinable,ReferenceCountingIndexedTable,ReferenceCountingSegment,RestrictedSegment,RowBasedIndexedTable,UnnestSegment,WrappedSegmentReference
public interface ReferenceCountedObjectInterface for an object that may have a reference acquired in the form of aCloseable. This is intended to be used with an implementation ofReferenceCountingCloseableObject, or anything else that wishes to provide a method to account for the acquire and release of a reference to the object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<Closeable>acquireReferences()This method is expected to increment a reference count and provide aCloseablethat decrements the reference count when closed.
-
-
-
Method Detail
-
acquireReferences
Optional<Closeable> acquireReferences()
This method is expected to increment a reference count and provide aCloseablethat decrements the reference count when closed. This is likely just a wrapper aroundReferenceCountingCloseableObject.incrementReferenceAndDecrementOnceCloseable(), but may also include any other associated references which should be incremented when this method is called, and decremented/released by the closeable. IMPORTANT NOTE: to fulfill the contract of this method, implementors must return a closeable to indicate that the reference can be acquired, even if there is nothing to close. Implementors should avoid allowing this method or theCloseableit creates to throw exceptions. For callers: if this method returns non-empty, IT MUST BE CLOSED, else reference counts can potentially leak.
-
-