Class ConcurrencyUtils
java.lang.Object
org.eclipse.epsilon.common.concurrent.ConcurrencyUtils
- Since:
- 1.6
- Author:
- Sina Madani
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of logical cores in the system.static final Thread -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> ConcurrentMap<K, V> static <K,V> ConcurrentMap<K, V> concurrentMap(int initialCapacity, int parallelism) static <K,V> ConcurrentMap<K, V> concurrentMap(Map<? extends K, ? extends V> initial) static final <T> Collection<T>static <T> Collection<T>concurrentOrderedCollection(Collection<? extends T> values) static <T> Set<T>static <T> Set<T>concurrentSet(int initialCapacity, int parallelism) static <T> Set<T>concurrentSet(Collection<T> initial) static voidexecuteAsync(Runnable r1, Runnable r2) Executes the two tasks asynchronously and blocks the calling thread until both have completed.static final booleanstatic final booleanstatic Callable<?>runnableToCallable(Runnable runnable) static Collection<Callable<?>>runnableToCallable(Collection<? extends Runnable> runnables)
-
Field Details
-
TOP_LEVEL_THREAD
-
DEFAULT_PARALLELISM
public static final int DEFAULT_PARALLELISMThe number of logical cores in the system.
-
-
Constructor Details
-
ConcurrencyUtils
public ConcurrencyUtils()
-
-
Method Details
-
isMainThread
public static final boolean isMainThread() -
isTopLevelThread
public static final boolean isTopLevelThread() -
concurrentOrderedCollection
-
concurrentOrderedCollection
-
concurrentSet
-
concurrentSet
-
concurrentSet
-
concurrentMap
-
concurrentMap
-
concurrentMap
-
executeAsync
public static void executeAsync(Runnable r1, Runnable r2) throws InterruptedException, ExecutionException Executes the two tasks asynchronously and blocks the calling thread until both have completed.- Parameters:
t1-t2-- Throws:
InterruptedExceptionExecutionException
-
runnableToCallable
-
runnableToCallable
-