public final class ConcurrencyUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
hash(Object object)
Returns a hash code for non-null Object x.
|
static int |
selectLock(Object key,
int numberOfLocks)
Selects a lock for a key.
|
static void |
shutdownAndWaitForTermination(ExecutorService pool,
int waitSeconds)
Properly shutdown and await pool termination for an arbitrary
amount of time.
|
public static int hash(Object object)
This function ensures that hashCodes that differ only by constant multiples at each bit position have a bounded number of collisions. (Doug Lea)
object - the object serving as a keypublic static int selectLock(Object key, int numberOfLocks) throws CacheException
key - CacheExceptionpublic static void shutdownAndWaitForTermination(ExecutorService pool, int waitSeconds) throws TimeoutException
pool - Pool to shutdownwaitSeconds - Seconds to wait before throwing exceptionTimeoutException - Thrown if the pool does not shutdown in the specified timeCopyright 2001-2021, Terracotta, Inc.