Package io.netty.channel
Class DefaultAddressedEnvelope<M,A extends 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 SocketAddress>
extends Object
implements AddressedEnvelope<M,A>
The default
AddressedEnvelope
implementation.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAddressedEnvelope
(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
Modifier and TypeMethodDescriptioncontent()
Returns the message wrapped by this envelope message.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
.retain()
Increases the reference count by1
.retain
(int increment) Increases the reference count by the specifiedincrement
.sender()
Returns the address of the sender of this message.toString()
touch()
Records the current access location of this object for debugging purposes.Records the current access location of this object with an additional arbitrary information for debugging purposes.
-
Field Details
-
message
-
sender
-
recipient
-
-
Constructor Details
-
DefaultAddressedEnvelope
Creates a new instance with the specifiedmessage
,recipient
address, andsender
address. -
DefaultAddressedEnvelope
Creates a new instance with the specifiedmessage
andrecipient
address. The sender address becomesnull
.
-
-
Method Details
-
content
Description copied from interface:AddressedEnvelope
Returns the message wrapped by this envelope message.- Specified by:
content
in interfaceAddressedEnvelope<M,
A extends SocketAddress>
-
sender
Description copied from interface:AddressedEnvelope
Returns the address of the sender of this message.- Specified by:
sender
in interfaceAddressedEnvelope<M,
A extends SocketAddress>
-
recipient
Description copied from interface:AddressedEnvelope
Returns the address of the recipient of this message.- Specified by:
recipient
in interfaceAddressedEnvelope<M,
A extends 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
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceAddressedEnvelope<M,
A extends SocketAddress> - Specified by:
retain
in interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceAddressedEnvelope<M,
A extends 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
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 SocketAddress> - Specified by:
touch
in interfaceReferenceCounted
-
touch
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 SocketAddress> - Specified by:
touch
in interfaceReferenceCounted
-
toString
-