-
public class DD128bTraceId extends DDTraceId
Class encapsulating the unsigned 128-bit id used for TraceIds.
It contains parsing and formatting to string for both decimal and hexadecimal representations. The string representations are either kept from parsing, or generated on demand and cached.
DD128bTraceId can represent either a 128-bit TraceId or a 64-bit TraceId. For 128-bit TraceId, highOrderBits contains a 32-bit timestamp store on the 32 higher bits and lowOrderBits contains a unique and random 64-bit id. For 64-bit TraceId, is set to
0and lowOrderBits contains a unique and random 63-bit id.
-
-
Field Summary
Fields Modifier and Type Field Description public final static DD128bTraceIdZERO
-
Method Summary
Modifier and Type Method Description static DD128bTraceIdfrom(long highOrderBits, long lowOrderBits)Create a new 128-bit DD128bTraceId from the given {@code long}s interpreted as highorder and low order bits of the 128-bit id.static DD128bTraceIdfromHex(String s)Create a new 128-bit DD128bTraceId from the given hexadecimal String representation. static DD128bTraceIdfromHex(String s, int start, int length, boolean lowerCaseOnly)Create a new 128-bit DD128bTraceId from the given hexadecimal String representation. StringtoHexString()Returns the lower-case zero-padded 32 hexadecimal characters String representation ofthe DD128bTraceId. StringtoHexStringPadded(int size)Returns the lower-case zero-padded hexadecimal String representation ofthe DDTraceId. longtoLong()Returns the low-order 64 bits of the DDTraceId as an unsigned {@code long}.longtoHighOrderLong()Returns the high-order 64 bits of 128-bit DDTraceId as un unsigned {@code long}.booleanequals(Object o)inthashCode()StringtoString()Returns a 64-bit only decimal String representation of the DDTraceId. -
-
Method Detail
-
from
static DD128bTraceId from(long highOrderBits, long lowOrderBits)
Create a new 128-bit DD128bTraceId from the given
{@code long}s interpreted as highorder and low order bits of the 128-bit id.- Parameters:
highOrderBits- A{@code long}representing the high-order bits of the .lowOrderBits- A{@code long}representing the random id low-order bits.
-
fromHex
static DD128bTraceId fromHex(String s)
Create a new 128-bit DD128bTraceId from the given hexadecimal String representation.
- Parameters:
s- The hexadecimal String representation to parse (a 32 lower-case hexadecimalcharacters maximum).
-
fromHex
static DD128bTraceId fromHex(String s, int start, int length, boolean lowerCaseOnly)
Create a new 128-bit DD128bTraceId from the given hexadecimal String representation.
- Parameters:
s- The string containing the hexadecimal String representation to parse (32 loweror higher-case hexadecimal characters maximum).start- The start index of the hexadecimal String representation to parse.length- The length of the hexadecimal String representation to parse.lowerCaseOnly- Whether the hexadecimal characters to parse are lower-case only or not.
-
toHexString
String toHexString()
Returns the lower-case zero-padded 32 hexadecimal characters String representation ofthe DD128bTraceId.
-
toHexStringPadded
String toHexStringPadded(int size)
Returns the lower-case zero-padded hexadecimal String representation ofthe DDTraceId. The size will be rounded up to
16or32characters. This hexadecimal Stringwill not be cached.- Parameters:
size- The size in characters of the zero-padded String (rounded up to16or32).
-
toLong
long toLong()
-
toHighOrderLong
long toHighOrderLong()
-
hashCode
int hashCode()
-
-
-
-