Documentation of 'pl.edu.icm.jlargearrays.ConcurrencyUtils' Java class
ConcurrencyUtils
pl.edu.icm.jlargearrays

Class ConcurrencyUtils



  • public class ConcurrencyUtils
    extends java.lang.Object
    Concurrency utilities.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static long getConcurrentThreshold()
      Returns the minimum length of array for which multiple threads are used.
      static int getNumberOfProcessors()
      Returns the number of available processors.
      static int getNumberOfThreads()
      Returns the current number of threads.
      static java.util.concurrent.ExecutorService getThreadPool()
      Returns the pool of threads.
      static void setConcurrentThreshold(long concurrentThreshold)
      Sets the minimum length of an array for which multiple threads are used.
      static void setNumberOfThreads(int n)
      Sets the number of threads.
      static void setThreadPool(java.util.concurrent.ExecutorService threadPool)
      Sets the pool of threads.
      static void shutdownThreadPoolAndAwaitTermination()
      Shutdowns all submitted tasks.
      static <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
      Submits a value-returning task for execution and returns a Future representing the pending results of the task.
      static java.util.concurrent.Future<?> submit(java.lang.Runnable task)
      Submits a Runnable task for execution and returns a Future representing that task.
      static void waitForCompletion(java.util.concurrent.Future<?>[] futures)
      Waits for all threads to complete computation.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getConcurrentThreshold

        public static long getConcurrentThreshold()
        Returns the minimum length of array for which multiple threads are used.

        Returns:
        the minimum length of array for which multiple threads are used
      • setConcurrentThreshold

        public static void setConcurrentThreshold(long concurrentThreshold)
        Sets the minimum length of an array for which multiple threads are used.

        Parameters:
        concurrentThreshold - minimum length of an array for which multiple threads are used
      • getNumberOfProcessors

        public static int getNumberOfProcessors()
        Returns the number of available processors.

        Returns:
        number of available processors
      • getNumberOfThreads

        public static int getNumberOfThreads()
        Returns the current number of threads.

        Returns:
        the current number of threads.
      • setNumberOfThreads

        public static void setNumberOfThreads(int n)
        Sets the number of threads.

        Parameters:
        n - new value of threads
      • submit

        public static <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
        Submits a value-returning task for execution and returns a Future representing the pending results of the task.

        Type Parameters:
        T - type
        Parameters:
        task - task for execution

        Returns:
        handle to the task submitted for execution
      • submit

        public static java.util.concurrent.Future<?> submit(java.lang.Runnable task)
        Submits a Runnable task for execution and returns a Future representing that task.

        Parameters:
        task - task for execution

        Returns:
        handle to the task submitted for execution
      • waitForCompletion

        public static void waitForCompletion(java.util.concurrent.Future<?>[] futures)
                                      throws java.lang.InterruptedException,
                                             java.util.concurrent.ExecutionException
        Waits for all threads to complete computation.

        Parameters:
        futures - list of handles to the tasks

        Throws:
        java.util.concurrent.ExecutionException - if the computation threw an exception
        java.lang.InterruptedException - if the current thread was interrupted while waiting
      • setThreadPool

        public static void setThreadPool(java.util.concurrent.ExecutorService threadPool)
        Sets the pool of threads.

        Parameters:
        threadPool - pool of threads
      • getThreadPool

        public static java.util.concurrent.ExecutorService getThreadPool()
        Returns the pool of threads.

        Returns:
        pool of threads
      • shutdownThreadPoolAndAwaitTermination

        public static void shutdownThreadPoolAndAwaitTermination()
        Shutdowns all submitted tasks.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.