edu.jas.kern
Class ComputerThreads

java.lang.Object
  extended by edu.jas.kern.ComputerThreads

public class ComputerThreads
extends java.lang.Object

ComputerThreads, provides global thread / executor service.

Author:
Heinz Kredel
Usage
To obtain a reference to the thread pool use ComputerThreads.getPool(). Once a pool has been created it must be shutdown to exit JAS with ComputerThreads.terminate().

Field Summary
static int N_CPUS
          Number of processors.
static int N_THREADS
          Maximal number of threads.
static int Q_CAPACITY
          Queue capacity.
static java.util.concurrent.RejectedExecutionHandler REH
          Saturation policy.
 
Method Summary
static java.util.concurrent.ExecutorService getPool()
          Get the thread pool.
static boolean isRunning()
          Test if a pool is running.
static void terminate()
          Stop execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

N_CPUS

public static final int N_CPUS
Number of processors.


N_THREADS

public static final int N_THREADS
Maximal number of threads. N_CPUS x 1.5, x 2, x 2.5, min 3, ?.


Q_CAPACITY

public static final int Q_CAPACITY
Queue capacity.

See Also:
Constant Field Values

REH

public static final java.util.concurrent.RejectedExecutionHandler REH
Saturation policy.

Method Detail

isRunning

public static boolean isRunning()
Test if a pool is running.

Returns:
true if a thread pool has been started or is running, else false.

getPool

public static java.util.concurrent.ExecutorService getPool()
Get the thread pool.

Returns:
pool ExecutorService.

terminate

public static void terminate()
Stop execution.