public final class UtilityElf extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
IS_JAVA7 |
Constructor and Description |
---|
UtilityElf() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
createInstance(String className,
Class<T> clazz,
Object... args)
Create and instance of the specified class using the constructor matching the specified
arguments.
|
static ThreadPoolExecutor |
createThreadPoolExecutor(int queueSize,
String threadName,
ThreadFactory threadFactory,
RejectedExecutionHandler policy)
Create a ThreadPoolExecutor.
|
static long |
elapsedTimeMs(long start)
Get the elapsed time in millisecond between the specified start time and now.
|
static int |
getTransactionIsolation(String transactionIsolationName)
Get the int value of a transaction isolation level by name.
|
static void |
quietlySleep(long millis)
Sleep and transform an InterruptedException into a RuntimeException.
|
static void |
setRemoveOnCancelPolicy(ScheduledThreadPoolExecutor executor)
If the scheduled executor supports it, set the removeonCancelPolicy.
|
public static long elapsedTimeMs(long start)
start
- the start timepublic static void quietlySleep(long millis)
millis
- the number of milliseconds to sleeppublic static void setRemoveOnCancelPolicy(ScheduledThreadPoolExecutor executor)
executor
- the executor to setpublic static <T> T createInstance(String className, Class<T> clazz, Object... args)
T
- the class typeclassName
- the name of the classto instantiateclazz
- a class to cast the result asargs
- arguments to a constructorpublic static ThreadPoolExecutor createThreadPoolExecutor(int queueSize, String threadName, ThreadFactory threadFactory, RejectedExecutionHandler policy)
queueSize
- the queue sizethreadName
- the thread namethreadFactory
- an optional ThreadFactorypolicy
- the RejectedExecutionHandler policypublic static int getTransactionIsolation(String transactionIsolationName)
transactionIsolationName
- the name of the transaction isolation levelCopyright © 2015 Zaxxer.com. All Rights Reserved.