Module org.elasticsearch.compute
Package org.elasticsearch.compute.data
Class AbstractNonThreadSafeRefCounted
java.lang.Object
org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
- All Implemented Interfaces:
Closeable,AutoCloseable,RefCounted,Releasable
- Direct Known Subclasses:
AbstractArrowBufBlock,AbstractArrowBufVector,AbstractDelegatingCompoundBlock,AggregateMetricDoubleArrayBlock,BooleanArrayBlock,BooleanArrayVector,BooleanBigArrayBlock,BooleanBigArrayVector,BooleanVectorBlock,BytesRefArrayBlock,BytesRefArrayVector,BytesRefVectorBlock,CompositeBlock,ConstantBooleanVector,ConstantBytesRefVector,ConstantDoubleVector,ConstantFloatVector,ConstantIntVector,ConstantLongVector,ConstantNullBlock,ConstantNullVector,DirectBytesRefVector,DocBlock,DocVector,DoubleArrayBlock,DoubleArrayVector,DoubleBigArrayBlock,DoubleBigArrayVector,DoubleVectorBlock,FloatArrayBlock,FloatArrayVector,FloatBigArrayBlock,FloatBigArrayVector,FloatVectorBlock,IntArrayBlock,IntArrayVector,IntBigArrayBlock,IntBigArrayVector,IntVectorBlock,LongArrayBlock,LongArrayVector,LongBigArrayBlock,LongBigArrayVector,LongRangeArrayBlock,LongVectorBlock,OrdinalBytesRefBlock,OrdinalBytesRefVector
public abstract class AbstractNonThreadSafeRefCounted
extends Object
implements RefCounted, Releasable
Releasable, non-threadsafe version of
AbstractRefCounted.
Calls to decRef() and close() are equivalent.-
Field Summary
Fields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidattachReleasable(Releasable releasable) Attaches aReleasablethat is invoked exactly once when this object's reference count reaches zero, immediately aftercloseInternal()completes.final voidclose()protected abstract voidThis is called when the number of references reaches zero.final booleandecRef()final booleanfinal voidincRef()final booleanfinal booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.core.RefCounted
mustIncRef
-
Constructor Details
-
AbstractNonThreadSafeRefCounted
public AbstractNonThreadSafeRefCounted()
-
-
Method Details
-
incRef
public final void incRef()- Specified by:
incRefin interfaceRefCounted
-
tryIncRef
public final boolean tryIncRef()- Specified by:
tryIncRefin interfaceRefCounted
-
attachReleasable
Attaches aReleasablethat is invoked exactly once when this object's reference count reaches zero, immediately aftercloseInternal()completes. May be called at most once; throwsIllegalStateExceptionif called after release or a second time. -
decRef
public final boolean decRef()- Specified by:
decRefin interfaceRefCounted
-
hasReferences
public final boolean hasReferences()- Specified by:
hasReferencesin interfaceRefCounted
-
close
public final void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable
-
isReleased
public final boolean isReleased() -
closeInternal
protected abstract void closeInternal()This is called when the number of references reaches zero. This is where resources should be released (adjusting circuit breakers if needed).
-