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 defaultAddressedEnvelopeimplementation.
-
-
Constructor Summary
Constructors Constructor Description DefaultAddressedEnvelope(M message, A recipient)Creates a new instance with the specifiedmessageandrecipientaddress.DefaultAddressedEnvelope(M message, A recipient, A sender)Creates a new instance with the specifiedmessage,recipientaddress, andsenderaddress.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mcontent()Returns the message wrapped by this envelope message.Arecipient()Returns the address of the recipient of this message.intrefCnt()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.booleanrelease(int decrement)Decreases the reference count by the specifieddecrementand 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.Asender()Returns the address of the sender of this message.java.lang.StringtoString()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:AddressedEnvelopeReturns the message wrapped by this envelope message.- Specified by:
contentin interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
-
sender
public A sender()
Description copied from interface:AddressedEnvelopeReturns the address of the sender of this message.- Specified by:
senderin interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
-
recipient
public A recipient()
Description copied from interface:AddressedEnvelopeReturns the address of the recipient of this message.- Specified by:
recipientin interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>
-
refCnt
public int refCnt()
Description copied from interface:ReferenceCountedReturns the reference count of this object. If0, it means this object has been deallocated.- Specified by:
refCntin interfaceReferenceCounted
-
retain
public AddressedEnvelope<M,A> retain()
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>- Specified by:
retainin interfaceReferenceCounted
-
retain
public AddressedEnvelope<M,A> retain(int increment)
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>- Specified by:
retainin interfaceReferenceCounted
-
release
public boolean release()
Description copied from interface:ReferenceCountedDecreases the reference count by1and deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
release
public boolean release(int decrement)
Description copied from interface:ReferenceCountedDecreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
touch
public AddressedEnvelope<M,A> touch()
Description copied from interface:ReferenceCountedRecords 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:
touchin interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>- Specified by:
touchin interfaceReferenceCounted
-
touch
public AddressedEnvelope<M,A> touch(java.lang.Object hint)
Description copied from interface:ReferenceCountedRecords 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:
touchin interfaceAddressedEnvelope<M,A extends java.net.SocketAddress>- Specified by:
touchin interfaceReferenceCounted
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-