Module io.netty5.common
Package io.netty5.util.internal
Class ReferenceCountUpdater<T extends ReferenceCounted>
- java.lang.Object
-
- io.netty5.util.internal.ReferenceCountUpdater<T>
-
public abstract class ReferenceCountUpdater<T extends ReferenceCounted> extends Object
Common logic forReferenceCounted
implementations
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReferenceCountUpdater()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static long
getUnsafeOffset(Class<? extends ReferenceCounted> clz, String fieldName)
int
initialValue()
boolean
isLiveNonVolatile(T instance)
int
refCnt(T instance)
boolean
release(T instance)
boolean
release(T instance, int decrement)
void
resetRefCnt(T instance)
Resets the reference count to 1T
retain(T instance)
T
retain(T instance, int increment)
void
setRefCnt(T instance, int refCnt)
An unsafe operation that sets the reference count directlyprotected abstract long
unsafeOffset()
protected abstract AtomicIntegerFieldUpdater<T>
updater()
-
-
-
Method Detail
-
getUnsafeOffset
public static long getUnsafeOffset(Class<? extends ReferenceCounted> clz, String fieldName)
-
updater
protected abstract AtomicIntegerFieldUpdater<T> updater()
-
unsafeOffset
protected abstract long unsafeOffset()
-
initialValue
public final int initialValue()
-
refCnt
public final int refCnt(T instance)
-
isLiveNonVolatile
public final boolean isLiveNonVolatile(T instance)
-
setRefCnt
public final void setRefCnt(T instance, int refCnt)
An unsafe operation that sets the reference count directly
-
resetRefCnt
public final void resetRefCnt(T instance)
Resets the reference count to 1
-
release
public final boolean release(T instance)
-
release
public final boolean release(T instance, int decrement)
-
-