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 message
A - 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 default AddressedEnvelope implementation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final M
     
    private final A
     
    private final A
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultAddressedEnvelope(M message, A recipient)
    Creates a new instance with the specified message and recipient address.
    DefaultAddressedEnvelope(M message, A recipient, A sender)
    Creates a new instance with the specified message, recipient address, and sender address.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the message wrapped by this envelope message.
    Returns the address of the recipient of this message.
    int
    Returns the reference count of this object.
    boolean
    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.
    Increases the reference count by 1.
    retain(int increment)
    Increases the reference count by the specified increment.
    Returns the address of the sender of this message.
    java.lang.String
     
    Records the current access location of this object for debugging purposes.
    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 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • message

      private final M message
    • sender

      private final A extends java.net.SocketAddress sender
    • recipient

      private final A extends java.net.SocketAddress recipient
  • Constructor Details

    • DefaultAddressedEnvelope

      public DefaultAddressedEnvelope(M message, A recipient, A sender)
      Creates a new instance with the specified message, recipient address, and sender address.
    • DefaultAddressedEnvelope

      public DefaultAddressedEnvelope(M message, A recipient)
      Creates a new instance with the specified message and recipient address. The sender address becomes null.
  • Method Details

    • content

      public M content()
      Description copied from interface: AddressedEnvelope
      Returns the message wrapped by this envelope message.
      Specified by:
      content in interface AddressedEnvelope<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 interface AddressedEnvelope<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 interface AddressedEnvelope<M, A extends java.net.SocketAddress>
    • refCnt

      public int refCnt()
      Description copied from interface: ReferenceCounted
      Returns the reference count of this object. If 0, it means this object has been deallocated.
      Specified by:
      refCnt in interface ReferenceCounted
    • retain

      public AddressedEnvelope<M,A> retain()
      Description copied from interface: ReferenceCounted
      Increases the reference count by 1.
      Specified by:
      retain in interface AddressedEnvelope<M, A extends java.net.SocketAddress>
      Specified by:
      retain in interface ReferenceCounted
    • retain

      public AddressedEnvelope<M,A> retain(int increment)
      Description copied from interface: ReferenceCounted
      Increases the reference count by the specified increment.
      Specified by:
      retain in interface AddressedEnvelope<M, A extends java.net.SocketAddress>
      Specified by:
      retain in interface ReferenceCounted
    • release

      public boolean release()
      Description copied from interface: ReferenceCounted
      Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
      Specified by:
      release in interface ReferenceCounted
      Returns:
      true if and only if the reference count became 0 and this object has been deallocated
    • release

      public boolean release(int decrement)
      Description copied from interface: ReferenceCounted
      Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
      Specified by:
      release in interface ReferenceCounted
      Returns:
      true if and only if the reference count became 0 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 via ResourceLeakDetector. This method is a shortcut to touch(null).
      Specified by:
      touch in interface AddressedEnvelope<M, A extends java.net.SocketAddress>
      Specified by:
      touch in interface ReferenceCounted
    • 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 via ResourceLeakDetector.
      Specified by:
      touch in interface AddressedEnvelope<M, A extends java.net.SocketAddress>
      Specified by:
      touch in interface ReferenceCounted
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object