Class DefaultChannelId

java.lang.Object
io.netty.channel.DefaultChannelId
All Implemented Interfaces:
ChannelId, Serializable, Comparable<ChannelId>

public final class DefaultChannelId extends Object implements ChannelId
The default ChannelId implementation.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • logger

      private static final InternalLogger logger
    • MACHINE_ID

      private static final byte[] MACHINE_ID
    • PROCESS_ID_LEN

      private static final int PROCESS_ID_LEN
      See Also:
    • PROCESS_ID

      private static final int PROCESS_ID
    • SEQUENCE_LEN

      private static final int SEQUENCE_LEN
      See Also:
    • TIMESTAMP_LEN

      private static final int TIMESTAMP_LEN
      See Also:
    • RANDOM_LEN

      private static final int RANDOM_LEN
      See Also:
    • nextSequence

      private static final AtomicInteger nextSequence
    • HEX_CHARS

      private static final char[] HEX_CHARS
    • machineId

      private final byte[] machineId
    • processId

      private final int processId
    • sequence

      private final int sequence
    • timestamp

      private final long timestamp
    • random

      private final int random
    • hashCode

      private final int hashCode
    • shortValue

      private transient String shortValue
    • longValue

      private transient String longValue
  • Constructor Details

    • DefaultChannelId

      DefaultChannelId(byte[] machineId, int processId, int sequence, long timestamp, int random)
      Visible for testing
  • Method Details

    • newInstance

      public static DefaultChannelId newInstance()
      Returns a new DefaultChannelId instance.
    • processHandlePid

      static int processHandlePid(ClassLoader loader)
    • jmxPid

      static int jmxPid(ClassLoader loader)
    • defaultProcessId

      static int defaultProcessId()
    • computeHashCode

      private int computeHashCode()
    • asShortText

      public String asShortText()
      Description copied from interface: ChannelId
      Returns the short but globally non-unique string representation of the ChannelId.
      Specified by:
      asShortText in interface ChannelId
    • asLongText

      public String asLongText()
      Description copied from interface: ChannelId
      Returns the long yet globally unique string representation of the ChannelId.
      Specified by:
      asLongText in interface ChannelId
    • newLongValue

      private String newLongValue()
    • appendHexBytes

      private static void appendHexBytes(StringBuilder buf, byte[] bytes)
    • appendHexInt

      private static void appendHexInt(StringBuilder buf, int value)
    • appendHexLong

      private static void appendHexLong(StringBuilder buf, long value)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(ChannelId o)
      Specified by:
      compareTo in interface Comparable<ChannelId>
    • compareBytes

      private static int compareBytes(byte[] a, byte[] b)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object