List of utility methods to do Thread Lock
void | sleepNanos(long nanos) sleep Nanos if (nanos <= 0) { return; LockSupport.parkNanos(nanos); |
void | sleepRandomNanos(Random random, long maxDelayNanos) Sleeps a random amount of time. if (maxDelayNanos <= 0) { return; long randomValue = Math.abs(random.nextLong()); long delayNanos = randomValue % maxDelayNanos; LockSupport.parkNanos(delayNanos); |