Package io.netty.channel
Class DefaultAddressedEnvelope<M,A extends java.net.SocketAddress>
- java.lang.Object
-
- io.netty.channel.DefaultAddressedEnvelope<M,A>
-
- Type Parameters:
M
- the type of the wrapped messageA
- the type of the recipient address
- All Implemented Interfaces:
AddressedEnvelope<M,A>
,ReferenceCounted
- Direct Known Subclasses:
DatagramPacket
,DomainDatagramPacket
public class DefaultAddressedEnvelope<M,A extends java.net.SocketAddress> extends java.lang.Object implements AddressedEnvelope<M,A>
The defaultAddressedEnvelope
implementation.
-
-
Constructor Summary
Constructors Constructor Description DefaultAddressedEnvelope(M message, A recipient)
Creates a new instance with the specifiedmessage
andrecipient
address.DefaultAddressedEnvelope(M message, A recipient, A sender)
Creates a new instance with the specifiedmessage
,recipient
address, andsender
address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description M
content()
Returns the message wrapped by this envelope message.A
recipient()
Returns the address of the recipient of this message.int
refCnt()
Returns the reference count of this object.boolean
release()
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.boolean
release(int decrement)
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.AddressedEnvelope<M,A>
retain()
Increases the reference count by1
.AddressedEnvelope<M,A>
retain(int increment)
Increases the reference count by the specifiedincrement
.A
sender()
Returns the address of the sender of this message.java.lang.String
toString()
AddressedEnvelope<M,A>
touch()
Records the current access location of this object for debugging purposes.AddressedEnvelope<M,A>
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging purposes.
-
-
-
Method Detail
-
content
public M content()
Description copied from interface:AddressedEnvelope
Returns the message wrapped by this envelope message.- Specified by:
content
in interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
-
sender
public A sender()
Description copied from interface:AddressedEnvelope
Returns the address of the sender of this message.- Specified by:
sender
in interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
-
recipient
public A recipient()
Description copied from interface:AddressedEnvelope
Returns the address of the recipient of this message.- Specified by:
recipient
in interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
-
refCnt
public int refCnt()
Description copied from interface:ReferenceCounted
Returns the reference count of this object. If0
, it means this object has been deallocated.- Specified by:
refCnt
in interfaceReferenceCounted
-
retain
public AddressedEnvelope<M,A> retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
- Specified by:
retain
in interfaceReferenceCounted
-
retain
public AddressedEnvelope<M,A> retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
- Specified by:
retain
in interfaceReferenceCounted
-
release
public boolean release()
Description copied from interface:ReferenceCounted
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
release
public boolean release(int decrement)
Description copied from interface:ReferenceCounted
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
touch
public AddressedEnvelope<M,A> 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 interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
- Specified by:
touch
in interfaceReferenceCounted
-
touch
public AddressedEnvelope<M,A> 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 interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
- Specified by:
touch
in interfaceReferenceCounted
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-