Top Description Fields Constructors Methods
io.netty.buffer

public abstract Class AbstractReferenceCountedByteBuf

extends AbstractByteBuf
Class Inheritance
Known Direct Subclasses
io.netty.buffer.ReadOnlyByteBufferBuf, io.netty.buffer.UnpooledDirectByteBuf, io.netty.buffer.UnpooledHeapByteBuf, io.netty.buffer.CompositeByteBuf, io.netty.buffer.FixedCompositeByteBuf, io.netty.buffer.PooledByteBuf, io.netty.buffer.AbstractPooledDerivedByteBuf
Imports
java.util.concurrent.atomic.AtomicIntegerFieldUpdater, io.netty.util.internal.ReferenceCountUpdater

Abstract base class for ByteBuf implementations that count references.

Field Summary

Modifier and TypeField and Description
private static final AtomicIntegerFieldUpdater<AbstractReferenceCountedByteBuf>
private volatile int
private static final long
private static final ReferenceCountUpdater<AbstractReferenceCountedByteBuf>
Inherited from io.netty.buffer.AbstractByteBuf:
checkAccessibleleakDetectorreaderIndexwriterIndex

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected abstract void
deallocate()

Called once refCnt() is equals 0.

private boolean
handleRelease(boolean result)

pack-priv boolean
isAccessible()

Overrides io.netty.buffer.ByteBuf.isAccessible.

Used internally by AbstractByteBuf#ensureAccessible() to try to guard against using the buffer after it was released (best-effort).
public int
refCnt()

Implements io.netty.util.ReferenceCounted.refCnt.

Returns the reference count of this object.
public boolean
release()

Implements io.netty.util.ReferenceCounted.release.

Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
public boolean
release(int decrement)

Implements io.netty.util.ReferenceCounted.release.

Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
protected final void
resetRefCnt()

An unsafe operation intended for use by a subclass that resets the reference count of the buffer to 1

public ByteBuf
retain()

Implements abstract io.netty.buffer.ByteBuf.retain.

Implements io.netty.util.ReferenceCounted.retain.

Increases the reference count by 1.
public ByteBuf
retain(int increment)

Implements abstract io.netty.buffer.ByteBuf.retain.

Implements io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.
protected final void
setRefCnt(int refCnt)

An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly

public ByteBuf
touch()

Implements abstract io.netty.buffer.ByteBuf.touch.

Implements io.netty.util.ReferenceCounted.touch.

Records the current access location of this object for debugging purposes.
public ByteBuf
touch(Object hint)

Implements abstract io.netty.buffer.ByteBuf.touch.

Implements io.netty.util.ReferenceCounted.touch.

Records the current access location of this object with an additional arbitrary information for debugging purposes.
Inherited from io.netty.buffer.AbstractByteBuf:
_getByte_getInt_getIntLE_getLong_getLongLE_getShort_getShortLE_getUnsignedMedium_getUnsignedMediumLE_setByte_setInt_setIntLE_setLong_setLongLE_setMedium_setMediumLE_setShort_setShortLEadjustMarkersasReadOnlybytesBeforebytesBeforebytesBeforecheckDstIndexcheckDstIndexcheckIndexcheckIndexcheckIndex0checkNewCapacitycheckReadableBytescheckSrcIndexclearcompareTocopydiscardMarksdiscardReadBytesdiscardSomeReadBytesduplicateensureAccessibleensureWritableensureWritableensureWritable0equalsforEachByteforEachByteforEachByteAsc0forEachByteDescforEachByteDescforEachByteDesc0getBooleangetBytegetBytesgetBytesgetBytesgetChargetCharSequencegetDoublegetFloatgetIntgetIntLEgetLonggetLongLEgetMediumgetMediumLEgetShortgetShortLEgetUnsignedBytegetUnsignedIntgetUnsignedIntLEgetUnsignedMediumgetUnsignedMediumLEgetUnsignedShortgetUnsignedShortLEhashCodeindexOfisReadableisReadableisReadOnlyisWritableisWritablemarkReaderIndexmarkWriterIndexmaxCapacitymaxCapacitymaxWritableBytesnewSwappedByteBufnioBuffernioBuffersorderreadableBytesreadBooleanreadBytereadBytesreadBytesreadBytesreadBytesreadBytesreadBytesreadBytesreadBytesreadBytesreadBytesreadCharreadCharSequencereadDoublereaderIndexreaderIndexreadFloatreadIntreadIntLEreadLongreadLongLEreadMediumreadMediumLEreadRetainedSlicereadShortreadShortLEreadSlicereadUnsignedBytereadUnsignedIntreadUnsignedIntLEreadUnsignedMediumreadUnsignedMediumLEreadUnsignedShortreadUnsignedShortLEresetReaderIndexresetWriterIndexretainedDuplicateretainedSliceretainedSlicesetBooleansetBytesetBytessetBytessetBytessetCharsetCharSequencesetDoublesetFloatsetIndexsetIndex0setIntsetIntLEsetLongsetLongLEsetMediumsetMediumLEsetShortsetShortLEsetZeroskipBytessliceslicetoStringtoStringtoStringtrimIndicesToCapacitywritableByteswriteBooleanwriteBytewriteByteswriteByteswriteByteswriteByteswriteByteswriteByteswriteByteswriteByteswriteByteswriteCharwriteCharSequencewriteDoublewriteFloatwriteIntwriteIntLEwriteLongwriteLongLEwriteMediumwriteMediumLEwriterIndexwriterIndexwriteShortwriteShortLEwriteZero

Field Detail

AIF_UPDATERback to summary
private static final AtomicIntegerFieldUpdater<AbstractReferenceCountedByteBuf> AIF_UPDATER
refCntback to summary
private volatile int refCnt
Annotations
@SuppressWarnings:unused, FieldMayBeFinal
REFCNT_FIELD_OFFSETback to summary
private static final long REFCNT_FIELD_OFFSET
updaterback to summary
private static final ReferenceCountUpdater<AbstractReferenceCountedByteBuf> updater

Constructor Detail

AbstractReferenceCountedByteBufback to summary
protected AbstractReferenceCountedByteBuf(int maxCapacity)

Method Detail

deallocateback to summary
protected abstract void deallocate()

Called once refCnt() is equals 0.

handleReleaseback to summary
private boolean handleRelease(boolean result)
isAccessibleback to summary
pack-priv boolean isAccessible()

Overrides io.netty.buffer.ByteBuf.isAccessible.

Doc from io.netty.buffer.ByteBuf.isAccessible.

Used internally by AbstractByteBuf#ensureAccessible() to try to guard against using the buffer after it was released (best-effort).

Annotations
@Override
refCntback to summary
public int refCnt()

Implements io.netty.util.ReferenceCounted.refCnt.

Doc from io.netty.util.ReferenceCounted.refCnt.

Returns the reference count of this object. If 0, it means this object has been deallocated.

Annotations
@Override
releaseback to summary
public boolean release()

Implements io.netty.util.ReferenceCounted.release.

Doc from io.netty.util.ReferenceCounted.release.

Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.

Returns:boolean

true if and only if the reference count became 0 and this object has been deallocated

Annotations
@Override
releaseback to summary
public boolean release(int decrement)

Implements io.netty.util.ReferenceCounted.release.

Doc from io.netty.util.ReferenceCounted.release.

Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.

Returns:boolean

true if and only if the reference count became 0 and this object has been deallocated

Annotations
@Override
resetRefCntback to summary
protected final void resetRefCnt()

An unsafe operation intended for use by a subclass that resets the reference count of the buffer to 1

retainback to summary
public ByteBuf retain()

Implements abstract io.netty.buffer.ByteBuf.retain.

Implements io.netty.util.ReferenceCounted.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by 1.

Annotations
@Override
retainback to summary
public ByteBuf retain(int increment)

Implements abstract io.netty.buffer.ByteBuf.retain.

Implements io.netty.util.ReferenceCounted.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.

Annotations
@Override
setRefCntback to summary
protected final void setRefCnt(int refCnt)

An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly

touchback to summary
public ByteBuf touch()

Implements abstract io.netty.buffer.ByteBuf.touch.

Implements io.netty.util.ReferenceCounted.touch.

Doc from io.netty.util.ReferenceCounted.touch.

Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector. This method is a shortcut to touch(null).

Annotations
@Override
touchback to summary
public ByteBuf touch(Object hint)

Implements abstract io.netty.buffer.ByteBuf.touch.

Implements io.netty.util.ReferenceCounted.touch.

Doc from io.netty.util.ReferenceCounted.touch.

Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector.

Annotations
@Override