public class DefaultThreadIDProvider extends java.lang.Object implements ThreadIDProvider
| Constructor and Description |
|---|
DefaultThreadIDProvider() |
| Modifier and Type | Method and Description |
|---|---|
static int |
convertNativeThreadIDToPositiveInteger(long nativeThreadID)
Converts a native thread id to a positive integer Thread.currentThread().getId()
|
int |
getThreadID()
Return s the current thread id
|
public int getThreadID()
ThreadIDProvidergetThreadID in interface ThreadIDProviderpublic static int convertNativeThreadIDToPositiveInteger(long nativeThreadID)
Thread.currentThread().getId() returns a long value. The Beacon protocol requires the thread id to be a positive integer value. By using the xor operation between higher and lower 32 bits of the long value we get an integer value. The returned integer can be negative though. Therefore the most significant bit is forced to '0' by a bitwise-and operation with an integer where all bits except for the most significant bit are set to '1'.
nativeThreadID - the native thread id returned by