Class ComputerThreads
java.lang.Object
edu.jas.kern.ComputerThreads
ComputerThreads, provides global thread / executor service.
Usage: To obtain a reference to the thread pool use
ComputerThreads.getPool(). Once a pool has been created it must
be shutdown with ComputerThreads.terminate() to exit JAS.
- Author:
- Heinz Kredel
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber of processors.static final intstatic booleanFlag for thread usage. -
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutorServicegetPool()Get the thread pool.static longGet timeout.static TimeUnitGet TimeUnit.static booleanTest if a pool is running.static voidSet no thread usage.static voidSet thread usage.static voidsetTimeout(long t) Set timeout.static voidSet TimeUnit.static voidStop execution.
-
Field Details
-
NO_THREADS
public static boolean NO_THREADSFlag for thread usage. Note: Only introduced because Google app engine does not support threads.- See Also:
-
N_CPUS
public static final int N_CPUSNumber of processors. -
N_THREADS
public static final int N_THREADS
-
-
Method Details
-
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
-
terminate
public static void terminate()Stop execution. -
setNoThreads
public static void setNoThreads()Set no thread usage. -
setThreads
public static void setThreads()Set thread usage. -
setTimeout
public static void setTimeout(long t) Set timeout.- Parameters:
t- time value to set
-
getTimeout
public static long getTimeout()Get timeout.- Returns:
- timeout value
-
setTimeUnit
-
getTimeUnit
-