The Robot Application Programming Interface Delegate Project
|
NOTE: This is an exact duplicate of the ThreadUtils class from core.ensemble it was copied here during cleanup/re-factor of RAPID plug-ins. More...
Static Public Member Functions | |
static void | sleep (long milliseconds) |
Like Thread.sleep() except without the necessity of surrounding with try/catch. | |
static ExecutorService | newPriorityThreadPool (String name, int numThreads) |
Creates a fixed priority thread pool. | |
static ExecutorService | newPriorityThreadPool (String name, int numThreads, Comparator< Runnable > comparator) |
Creates a fixed priority thread pool, sorted with the given comparator. | |
static ExecutorService | newCoalescingThreadPool (String name) |
Creates a single thread executor which ignores all executions that occur while it is busy executing a Runnable. | |
static ExecutorService | newLastRequestThreadPool (String name) |
Similar to newCoalescingThreadPool(String), but always runs the last runnable put into the pool. | |
static ExecutorService | newFixedThreadPool (String name, int numThreads) |
static ExecutorService | newFixedThreadPool (String name, int numThreads, int maxPoolSize, int keepAliveTimeInSeconds) |
static ExecutorService | newSingleThreadExecutor (String name) |
static ThreadFactory | newNamedThreadFactory (final String name) |
static void | addShutdownHook (Thread hook) |
static String | traceCaller () |
It should live somewhere that is more common, but not as part of something as obese as core.ensemble
A class of static utility methods for dealing with threads and thread pools.
static void addShutdownHook | ( | Thread | hook | ) | [static] |
static ExecutorService newCoalescingThreadPool | ( | String | name | ) | [static] |
This is useful for tasks that may be requested multiple times from multiple sources, but which only need to take place once.
name | the name for threads created within this pool |
static ExecutorService newFixedThreadPool | ( | String | name, |
int | numThreads | ||
) | [static] |
static ExecutorService newFixedThreadPool | ( | String | name, |
int | numThreads, | ||
int | maxPoolSize, | ||
int | keepAliveTimeInSeconds | ||
) | [static] |
static ExecutorService newLastRequestThreadPool | ( | String | name | ) | [static] |
If runnable a is executed, and then runnable b and c are executed while a is still running, runnable b will be dropped and c will executed.
static ThreadFactory newNamedThreadFactory | ( | final String | name | ) | [static] |
static ExecutorService newPriorityThreadPool | ( | String | name, |
int | numThreads | ||
) | [static] |
static ExecutorService newPriorityThreadPool | ( | String | name, |
int | numThreads, | ||
Comparator< Runnable > | comparator | ||
) | [static] |
static ExecutorService newSingleThreadExecutor | ( | String | name | ) | [static] |
static void sleep | ( | long | milliseconds | ) | [static] |
static String traceCaller | ( | ) | [static] |