com.hazelcast.util

## Class ThreadUtil

- java.lang.Object
- - com.hazelcast.util.ThreadUtil

-     public final class ThreadUtil
      extends Object

  Utility class to manipulate and query thread ID.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `assertRunningOnPartitionThread()`
    `static String` | `createThreadName(String hzName, String name)` Creates the threadname with prefix and notation.
    `static String` | `createThreadPoolName(String hzName, String poolName)` Creates the threadpool name with prefix and notation.
    `static long` | `getThreadId()` Get the thread ID.
    `static void` | `removeThreadId()` Remove the thread ID.
    `static void` | `setThreadId(long threadId)` Set the thread ID.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getThreadId

          public static long getThreadId()

      Get the thread ID.
      Returns:
        the thread ID

    - #### setThreadId

          public static void setThreadId(long threadId)

      Set the thread ID.
      Parameters:
        `threadId` - thread ID to set

    - #### removeThreadId

          public static void removeThreadId()

      Remove the thread ID.

    - #### createThreadName

          public static String createThreadName(String hzName,
                                                String name)

      Creates the threadname with prefix and notation.
      Parameters:
        `hzName` - the name of the hazelcast instance
        `name` - the basic name of the thread
      Returns:
        the threadname .
      Throws:
        `NullPointerException` - if name is null.

    - #### createThreadPoolName

          public static String createThreadPoolName(String hzName,
                                                    String poolName)

      Creates the threadpool name with prefix and notation.
      Parameters:
        `hzName` - the name of the hazelcast instance
        `poolName` - the name of the pool.
      Returns:
        the threadpool name.
      Throws:
        `NullPointerException` - if poolname is null.

    - #### assertRunningOnPartitionThread

          public static void assertRunningOnPartitionThread()

Copyright © 2020. All rights reserved.