public class ConcurrencyUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
extendDimension(int x) |
static int |
getNumberOfProcessors()
Returns the number of available processors
|
static int |
getNumberOfThreads()
Returns the current number of threads.
|
static boolean |
isForceThreads() |
static boolean |
isPowerOf2(int n)
Checks if n is a power-of-two number
|
static int |
nextExp2(int n) |
static int |
nextPow2(int n)
Returns the closest power of two greater than or equal to x.
|
static int |
prevPow2(int x)
Returns the closest power of two less than or equal to x
|
static void |
setForceThreads(boolean forceThreads) |
static void |
setNumberOfThreads(int n)
Sets the number of threads
|
static void |
sleep(long millis)
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of
milliseconds.
|
static <T> Future<T> |
submit(Callable<T> task)
Submits a value-returning task for execution and returns a Future representing the pending results of the task.
|
static Future<?> |
submit(Runnable task)
Submits a Runnable task for execution and returns a Future representing that task.
|
static void |
waitForCompletion(Future<?>[] futures)
Waits for all threads to complete computation.
|
public static int extendDimension(int x)
public static int getNumberOfProcessors()
public static int getNumberOfThreads()
public static boolean isForceThreads()
public static boolean isPowerOf2(int n)
n - input parameterpublic static int nextExp2(int n)
public static int nextPow2(int n)
n - input parameterpublic static int prevPow2(int x)
x - input parameterpublic static void setForceThreads(boolean forceThreads)
forceThreads - the forceThreads to setpublic static void setNumberOfThreads(int n)
n - number of requested threadspublic static void sleep(long millis)
millis - sleep duration in [ms]public static <T> Future<T> submit(Callable<T> task)
T - value type of callabletask - task for executionpublic static Future<?> submit(Runnable task)
task - task for executionpublic static void waitForCompletion(Future<?>[] futures)
futures - handles to running threadsCopyright © 2020 GSI Helmholtzzentrum für Schwerionenforschung GmbH. All rights reserved.