class OrientsecUUIDGenerator {

  public static String getGrpcUuid(long threadID, long currentTime) {
    if (threadID < MAX_THREAD_COUNT) {
      int index = (int) threadID;
      countList[index]++;

      char[] dstArray = new char[36];

      threadID = (threadID << 4) + PID_LOCAL_IP_NUM;
      currentTime = currentTime + (countList[index] << 4);

      NessUUID.digits(dstArray, 0, 8, threadID >> 32);
      dstArray[8] = '-';
      NessUUID.digits(dstArray, 9, 4, threadID >> 16);
      dstArray[13] = '-';
      NessUUID.digits(dstArray, 14, 4, threadID);
      dstArray[18] = '-';
      NessUUID.digits(dstArray, 19, 4, currentTime >> 48);
      dstArray[23] = '-';
      NessUUID.digits(dstArray, 24, 12, currentTime);

      return new String(dstArray);
    } else {
      // 超过MAX_THREAD_COUNT的就只用随机数
      return UUIDGenerator.newRandomUUID();
    }
  }

}