Class AbstractBinaryMemcacheMessage
- java.lang.Object
-
- io.netty.util.AbstractReferenceCounted
-
- io.netty.handler.codec.memcache.AbstractMemcacheObject
-
- io.netty.handler.codec.memcache.binary.AbstractBinaryMemcacheMessage
-
- All Implemented Interfaces:
DecoderResultProvider
,BinaryMemcacheMessage
,MemcacheMessage
,MemcacheObject
,ReferenceCounted
- Direct Known Subclasses:
DefaultBinaryMemcacheRequest
,DefaultBinaryMemcacheResponse
@UnstableApi public abstract class AbstractBinaryMemcacheMessage extends AbstractMemcacheObject implements BinaryMemcacheMessage
Default implementation of aBinaryMemcacheMessage
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractBinaryMemcacheMessage(ByteBuf key, ByteBuf extras)
Create a new instance with all properties set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
cas()
Returns the CAS identifier.byte
dataType()
Returns the data type of the message.protected void
deallocate()
Called onceAbstractReferenceCounted.refCnt()
is equals 0.ByteBuf
extras()
Returns aByteBuf
representation of the optional extras.byte
extrasLength()
Return the extras length of the message.ByteBuf
key()
Returns the optional key of the document.short
keyLength()
Returns the key length of the message.byte
magic()
Returns the magic byte for the message.int
opaque()
Returns the opaque value.byte
opcode()
Returns the opcode for the message.BinaryMemcacheMessage
retain()
Increases the reference count by1
.BinaryMemcacheMessage
retain(int increment)
Increases the reference count by the specifiedincrement
.BinaryMemcacheMessage
setCas(long cas)
Sets the CAS identifier.BinaryMemcacheMessage
setDataType(byte dataType)
Sets the data type of the message.BinaryMemcacheMessage
setExtras(ByteBuf extras)
Sets the extras buffer on the message.BinaryMemcacheMessage
setKey(ByteBuf key)
Sets the key of the document.BinaryMemcacheMessage
setMagic(byte magic)
Sets the magic byte.BinaryMemcacheMessage
setOpaque(int opaque)
Sets the opaque value.BinaryMemcacheMessage
setOpcode(byte opcode)
Sets the opcode for the message.BinaryMemcacheMessage
setTotalBodyLength(int totalBodyLength)
Sets the total body length.int
totalBodyLength()
Returns the total body length.BinaryMemcacheMessage
touch()
Records the current access location of this object for debugging purposes.BinaryMemcacheMessage
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging purposes.-
Methods inherited from class io.netty.handler.codec.memcache.AbstractMemcacheObject
decoderResult, setDecoderResult
-
Methods inherited from class io.netty.util.AbstractReferenceCounted
refCnt, release, release, setRefCnt
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.handler.codec.DecoderResultProvider
decoderResult, setDecoderResult
-
Methods inherited from interface io.netty.util.ReferenceCounted
refCnt, release, release
-
-
-
-
Method Detail
-
key
public ByteBuf key()
Description copied from interface:BinaryMemcacheMessage
Returns the optional key of the document.- Specified by:
key
in interfaceBinaryMemcacheMessage
- Returns:
- the key of the document.
-
extras
public ByteBuf extras()
Description copied from interface:BinaryMemcacheMessage
Returns aByteBuf
representation of the optional extras.- Specified by:
extras
in interfaceBinaryMemcacheMessage
- Returns:
- the optional extras.
-
setKey
public BinaryMemcacheMessage setKey(ByteBuf key)
Description copied from interface:BinaryMemcacheMessage
Sets the key of the document.ReferenceCounted.release()
ownership ofkey
is transferred to thisBinaryMemcacheMessage
.- Specified by:
setKey
in interfaceBinaryMemcacheMessage
- Parameters:
key
- the key of the message.ReferenceCounted.release()
ownership is transferred to thisBinaryMemcacheMessage
.
-
setExtras
public BinaryMemcacheMessage setExtras(ByteBuf extras)
Description copied from interface:BinaryMemcacheMessage
Sets the extras buffer on the message.ReferenceCounted.release()
ownership ofextras
is transferred to thisBinaryMemcacheMessage
.- Specified by:
setExtras
in interfaceBinaryMemcacheMessage
- Parameters:
extras
- the extras buffer of the document.ReferenceCounted.release()
ownership is transferred to thisBinaryMemcacheMessage
.
-
magic
public byte magic()
Description copied from interface:BinaryMemcacheMessage
Returns the magic byte for the message.- Specified by:
magic
in interfaceBinaryMemcacheMessage
- Returns:
- the magic byte.
-
setMagic
public BinaryMemcacheMessage setMagic(byte magic)
Description copied from interface:BinaryMemcacheMessage
Sets the magic byte.- Specified by:
setMagic
in interfaceBinaryMemcacheMessage
- Parameters:
magic
- the magic byte to use.- See Also:
for typesafe opcodes.
-
cas
public long cas()
Description copied from interface:BinaryMemcacheMessage
Returns the CAS identifier.- Specified by:
cas
in interfaceBinaryMemcacheMessage
- Returns:
- the CAS identifier.
-
setCas
public BinaryMemcacheMessage setCas(long cas)
Description copied from interface:BinaryMemcacheMessage
Sets the CAS identifier.- Specified by:
setCas
in interfaceBinaryMemcacheMessage
- Parameters:
cas
- the CAS identifier to use.
-
opaque
public int opaque()
Description copied from interface:BinaryMemcacheMessage
Returns the opaque value.- Specified by:
opaque
in interfaceBinaryMemcacheMessage
- Returns:
- the opaque value.
-
setOpaque
public BinaryMemcacheMessage setOpaque(int opaque)
Description copied from interface:BinaryMemcacheMessage
Sets the opaque value.- Specified by:
setOpaque
in interfaceBinaryMemcacheMessage
- Parameters:
opaque
- the opaque value to use.
-
totalBodyLength
public int totalBodyLength()
Description copied from interface:BinaryMemcacheMessage
Returns the total body length. Note that this may be 0, since the body is optional.- Specified by:
totalBodyLength
in interfaceBinaryMemcacheMessage
- Returns:
- the total body length.
-
setTotalBodyLength
public BinaryMemcacheMessage setTotalBodyLength(int totalBodyLength)
Description copied from interface:BinaryMemcacheMessage
Sets the total body length. Note that this may be 0, since the body length is optional.- Specified by:
setTotalBodyLength
in interfaceBinaryMemcacheMessage
- Parameters:
totalBodyLength
- the total body length.
-
dataType
public byte dataType()
Description copied from interface:BinaryMemcacheMessage
Returns the data type of the message.- Specified by:
dataType
in interfaceBinaryMemcacheMessage
- Returns:
- the data type of the message.
-
setDataType
public BinaryMemcacheMessage setDataType(byte dataType)
Description copied from interface:BinaryMemcacheMessage
Sets the data type of the message.- Specified by:
setDataType
in interfaceBinaryMemcacheMessage
- Parameters:
dataType
- the data type of the message.
-
extrasLength
public byte extrasLength()
Description copied from interface:BinaryMemcacheMessage
Return the extras length of the message. This may be 0, since the extras content is optional.- Specified by:
extrasLength
in interfaceBinaryMemcacheMessage
- Returns:
- the extras length.
-
keyLength
public short keyLength()
Description copied from interface:BinaryMemcacheMessage
Returns the key length of the message. This may return 0, since the key is optional.- Specified by:
keyLength
in interfaceBinaryMemcacheMessage
- Returns:
- the key length.
-
opcode
public byte opcode()
Description copied from interface:BinaryMemcacheMessage
Returns the opcode for the message.- Specified by:
opcode
in interfaceBinaryMemcacheMessage
- Returns:
- the opcode.
-
setOpcode
public BinaryMemcacheMessage setOpcode(byte opcode)
Description copied from interface:BinaryMemcacheMessage
Sets the opcode for the message.- Specified by:
setOpcode
in interfaceBinaryMemcacheMessage
- Parameters:
opcode
- the opcode to use.
-
retain
public BinaryMemcacheMessage retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceBinaryMemcacheMessage
- Specified by:
retain
in interfaceMemcacheMessage
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classAbstractReferenceCounted
-
retain
public BinaryMemcacheMessage retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceBinaryMemcacheMessage
- Specified by:
retain
in interfaceMemcacheMessage
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classAbstractReferenceCounted
-
deallocate
protected void deallocate()
Description copied from class:AbstractReferenceCounted
Called onceAbstractReferenceCounted.refCnt()
is equals 0.- Specified by:
deallocate
in classAbstractReferenceCounted
-
touch
public BinaryMemcacheMessage touch()
Description copied from interface:ReferenceCounted
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 viaResourceLeakDetector
. This method is a shortcut totouch(null)
.- Specified by:
touch
in interfaceBinaryMemcacheMessage
- Specified by:
touch
in interfaceMemcacheMessage
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classAbstractReferenceCounted
-
touch
public BinaryMemcacheMessage touch(java.lang.Object hint)
Description copied from interface:ReferenceCounted
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 viaResourceLeakDetector
.- Specified by:
touch
in interfaceBinaryMemcacheMessage
- Specified by:
touch
in interfaceMemcacheMessage
- Specified by:
touch
in interfaceReferenceCounted
-
-