Package edu.jas.kern

Class ComputerThreads


  • public class ComputerThreads
    extends java.lang.Object
    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.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.apache.logging.log4j.Logger logger  
      static int N_CPUS
      Number of processors.
      static int N_THREADS  
      static boolean NO_THREADS
      Flag for thread usage.
      (package private) static java.util.concurrent.ExecutorService pool
      ExecutorService thread pool.
      (package private) static long timeout
      Timeout for timed execution.
      (package private) static java.util.concurrent.TimeUnit timeunit
      TimeUnit for timed execution.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ComputerThreads()
      No public constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.concurrent.ExecutorService getPool()
      Get the thread pool.
      static long getTimeout()
      Get timeout.
      static java.util.concurrent.TimeUnit getTimeUnit()
      Get TimeUnit.
      static boolean isRunning()
      Test if a pool is running.
      static void setNoThreads()
      Set no thread usage.
      static void setThreads()
      Set thread usage.
      static void setTimeout​(long t)
      Set timeout.
      static void setTimeUnit​(java.util.concurrent.TimeUnit t)
      Set TimeUnit.
      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

      • logger

        private static final org.apache.logging.log4j.Logger logger
      • N_CPUS

        public static final int N_CPUS
        Number of processors.
      • N_THREADS

        public static final int N_THREADS
      • timeout

        static long timeout
        Timeout for timed execution.
        See Also:
        SGCDParallelProxy
      • timeunit

        static java.util.concurrent.TimeUnit timeunit
        TimeUnit for timed execution.
        See Also:
        SGCDParallelProxy
      • pool

        static java.util.concurrent.ExecutorService pool
        ExecutorService thread pool.
    • Constructor Detail

      • ComputerThreads

        private ComputerThreads()
        No public constructor.
    • 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.
      • 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

        public static void setTimeUnit​(java.util.concurrent.TimeUnit t)
        Set TimeUnit.
        Parameters:
        t - TimeUnit value to set
      • getTimeUnit

        public static java.util.concurrent.TimeUnit getTimeUnit()
        Get TimeUnit.
        Returns:
        timeunit value