Package io.netty.channel
Class DefaultChannelId
- java.lang.Object
-
- io.netty.channel.DefaultChannelId
-
public final class DefaultChannelId extends java.lang.Object implements ChannelId
The defaultChannelIdimplementation.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private inthashCodeprivate static char[]HEX_CHARSprivate static InternalLoggerloggerprivate java.lang.StringlongValueprivate static byte[]MACHINE_IDprivate byte[]machineIdprivate static java.util.concurrent.atomic.AtomicIntegernextSequenceprivate static intPROCESS_IDprivate static intPROCESS_ID_LENprivate intprocessIdprivate intrandomprivate static intRANDOM_LENprivate intsequenceprivate static intSEQUENCE_LENprivate static longserialVersionUIDprivate java.lang.StringshortValueprivate longtimestampprivate static intTIMESTAMP_LEN
-
Constructor Summary
Constructors Constructor Description DefaultChannelId(byte[] machineId, int processId, int sequence, long timestamp, int random)Visible for testing
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidappendHexBytes(java.lang.StringBuilder buf, byte[] bytes)private static voidappendHexInt(java.lang.StringBuilder buf, int value)private static voidappendHexLong(java.lang.StringBuilder buf, long value)java.lang.StringasLongText()Returns the long yet globally unique string representation of theChannelId.java.lang.StringasShortText()Returns the short but globally non-unique string representation of theChannelId.private static intcompareBytes(byte[] a, byte[] b)intcompareTo(ChannelId o)private intcomputeHashCode()(package private) static intdefaultProcessId()booleanequals(java.lang.Object obj)inthashCode()(package private) static intjmxPid(java.lang.ClassLoader loader)static DefaultChannelIdnewInstance()Returns a newDefaultChannelIdinstance.private java.lang.StringnewLongValue()(package private) static intprocessHandlePid(java.lang.ClassLoader loader)java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
PROCESS_ID
private static final int PROCESS_ID
-
SEQUENCE_LEN
private static final int SEQUENCE_LEN
- See Also:
- Constant Field Values
-
TIMESTAMP_LEN
private static final int TIMESTAMP_LEN
- See Also:
- Constant Field Values
-
RANDOM_LEN
private static final int RANDOM_LEN
- See Also:
- Constant Field Values
-
nextSequence
private static final java.util.concurrent.atomic.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 java.lang.String shortValue
-
longValue
private transient java.lang.String longValue
-
-
Method Detail
-
newInstance
public static DefaultChannelId newInstance()
Returns a newDefaultChannelIdinstance.
-
processHandlePid
static int processHandlePid(java.lang.ClassLoader loader)
-
jmxPid
static int jmxPid(java.lang.ClassLoader loader)
-
defaultProcessId
static int defaultProcessId()
-
computeHashCode
private int computeHashCode()
-
asShortText
public java.lang.String asShortText()
Description copied from interface:ChannelIdReturns the short but globally non-unique string representation of theChannelId.- Specified by:
asShortTextin interfaceChannelId
-
asLongText
public java.lang.String asLongText()
Description copied from interface:ChannelIdReturns the long yet globally unique string representation of theChannelId.- Specified by:
asLongTextin interfaceChannelId
-
newLongValue
private java.lang.String newLongValue()
-
appendHexBytes
private static void appendHexBytes(java.lang.StringBuilder buf, byte[] bytes)
-
appendHexInt
private static void appendHexInt(java.lang.StringBuilder buf, int value)
-
appendHexLong
private static void appendHexLong(java.lang.StringBuilder buf, long value)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(ChannelId o)
- Specified by:
compareToin interfacejava.lang.Comparable<ChannelId>
-
compareBytes
private static int compareBytes(byte[] a, byte[] b)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-