public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf
ByteBuf
implementations that count references.Modifier | Constructor and Description |
---|---|
protected |
AbstractReferenceCountedByteBuf(int maxCapacity) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
deallocate()
Called once
refCnt() is equals 0. |
int |
refCnt()
Returns the reference count of this object.
|
boolean |
release()
Decreases the reference count by
1 and deallocates this object if the reference count reaches at
0 . |
boolean |
release(int decrement)
Decreases the reference count by the specified
decrement and deallocates this object if the reference
count reaches at 0 . |
ByteBuf |
retain()
Increases the reference count by
1 . |
ByteBuf |
retain(int increment)
Increases the reference count by the specified
increment . |
protected void |
setRefCnt(int refCnt)
An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly
|
ByteBuf |
touch()
Records the current access location of this object for debugging purposes.
|
ByteBuf |
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
_getByte, _getInt, _getIntLE, _getLong, _getLongLE, _getShort, _getShortLE, _getUnsignedMedium, _getUnsignedMediumLE, _setByte, _setInt, _setIntLE, _setLong, _setLongLE, _setMedium, _setMediumLE, _setShort, _setShortLE, adjustMarkers, asReadOnly, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkIndex, checkIndex, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardReadBytes, discardSomeReadBytes, duplicate, ensureAccessible, ensureWritable, ensureWritable, equals, forEachByte, forEachByte, forEachByteDesc, forEachByteDesc, getBoolean, getByte, getBytes, getBytes, getBytes, getChar, getCharSequence, getDouble, getFloat, getInt, getIntLE, getLong, getLongLE, getMedium, getMediumLE, getShort, getShortLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedMedium, getUnsignedMediumLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, isReadOnly, isWritable, isWritable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readCharSequence, readDouble, readerIndex, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readRetainedSlice, readShort, readShortLE, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedMedium, readUnsignedMediumLE, readUnsignedShort, readUnsignedShortLE, resetReaderIndex, resetWriterIndex, retainedDuplicate, retainedSlice, retainedSlice, setBoolean, setByte, setBytes, setBytes, setBytes, setChar, setCharSequence, setDouble, setFloat, setIndex, setInt, setIntLE, setLong, setLongLE, setMedium, setMediumLE, setShort, setShortLE, setZero, skipBytes, slice, slice, toString, toString, toString, writableBytes, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeChar, writeCharSequence, writeDouble, writeFloat, writeInt, writeIntLE, writeLong, writeLongLE, writeMedium, writeMediumLE, writerIndex, writerIndex, writeShort, writeShortLE, writeZero
alloc, array, arrayOffset, capacity, capacity, copy, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, hasArray, hasMemoryAddress, internalNioBuffer, isDirect, memoryAddress, nioBuffer, nioBufferCount, nioBuffers, order, setBytes, setBytes, setBytes, setBytes, setBytes, setBytes, unwrap
protected AbstractReferenceCountedByteBuf(int maxCapacity)
public int refCnt()
ReferenceCounted
0
, it means this object has been deallocated.protected final void setRefCnt(int refCnt)
public ByteBuf retain()
ReferenceCounted
1
.retain
in interface ReferenceCounted
retain
in class ByteBuf
public ByteBuf retain(int increment)
ReferenceCounted
increment
.retain
in interface ReferenceCounted
retain
in class ByteBuf
public ByteBuf touch()
ReferenceCounted
ResourceLeakDetector
. This method is a shortcut to touch(null)
.touch
in interface ReferenceCounted
touch
in class ByteBuf
public ByteBuf touch(Object hint)
ReferenceCounted
ResourceLeakDetector
.touch
in interface ReferenceCounted
touch
in class ByteBuf
public boolean release()
ReferenceCounted
1
and deallocates this object if the reference count reaches at
0
.true
if and only if the reference count became 0
and this object has been deallocatedpublic boolean release(int decrement)
ReferenceCounted
decrement
and deallocates this object if the reference
count reaches at 0
.true
if and only if the reference count became 0
and this object has been deallocatedprotected abstract void deallocate()
refCnt()
is equals 0.Copyright © 2008–2017 The Netty Project. All rights reserved.