The Robot Application Programming Interface Delegate Project
RAPID Logo

ThreadUtils Class Reference

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...

List of all members.

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 ()

Detailed Description

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.


Member Function Documentation

static void addShutdownHook ( Thread  hook) [static]
See also:
Runtime.addShutdownHook(Thread)
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.

Parameters:
namethe name for threads created within this pool

Here is the call graph for this function:

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]

Here is the call graph for this function:

static ExecutorService newPriorityThreadPool ( String  name,
int  numThreads,
Comparator< Runnable >  comparator 
) [static]

Here is the call graph for this function:

static ExecutorService newSingleThreadExecutor ( String  name) [static]
static void sleep ( long  milliseconds) [static]
static String traceCaller ( ) [static]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines