Class ConcurrencyUtils
- java.lang.Object
-
- org.eclipse.epsilon.common.concurrent.ConcurrencyUtils
-
public class ConcurrencyUtils extends Object
- Since:
- 1.6
- Author:
- Sina Madani
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PARALLELISM
The number of logical cores in the system.static Thread
TOP_LEVEL_THREAD
-
Constructor Summary
Constructors Constructor Description ConcurrencyUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
ConcurrentMap<K,V>concurrentMap()
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 <T> Collection<T>
concurrentOrderedCollection()
static <T> Collection<T>
concurrentOrderedCollection(Collection<? extends T> values)
static <T> Set<T>
concurrentSet()
static <T> Set<T>
concurrentSet(int initialCapacity, int parallelism)
static <T> Set<T>
concurrentSet(Collection<T> initial)
static void
executeAsync(Runnable r1, Runnable r2)
Executes the two tasks asynchronously and blocks the calling thread until both have completed.static boolean
isMainThread()
static boolean
isTopLevelThread()
static Callable<?>
runnableToCallable(Runnable runnable)
static Collection<Callable<?>>
runnableToCallable(Collection<? extends Runnable> runnables)
-
-
-
Field Detail
-
TOP_LEVEL_THREAD
public static final Thread TOP_LEVEL_THREAD
-
DEFAULT_PARALLELISM
public static final int DEFAULT_PARALLELISM
The number of logical cores in the system.
-
-
Method Detail
-
isMainThread
public static final boolean isMainThread()
-
isTopLevelThread
public static final boolean isTopLevelThread()
-
concurrentOrderedCollection
public static final <T> Collection<T> concurrentOrderedCollection()
-
concurrentOrderedCollection
public static <T> Collection<T> concurrentOrderedCollection(Collection<? extends T> values)
-
concurrentSet
public static <T> Set<T> concurrentSet()
-
concurrentSet
public static <T> Set<T> concurrentSet(Collection<T> initial)
-
concurrentSet
public static <T> Set<T> concurrentSet(int initialCapacity, int parallelism)
-
concurrentMap
public static <K,V> ConcurrentMap<K,V> concurrentMap()
-
concurrentMap
public static <K,V> ConcurrentMap<K,V> concurrentMap(Map<? extends K,? extends V> initial)
-
concurrentMap
public static <K,V> ConcurrentMap<K,V> concurrentMap(int initialCapacity, int parallelism)
-
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:
InterruptedException
ExecutionException
-
runnableToCallable
public static Collection<Callable<?>> runnableToCallable(Collection<? extends Runnable> runnables)
-
-