Class ConcurrencyUtils

java.lang.Object
org.eclipse.epsilon.common.concurrent.ConcurrencyUtils

public class ConcurrencyUtils extends Object
Since:
1.6
Author:
Sina Madani
  • Field Details

    • 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.
  • Constructor Details

    • ConcurrencyUtils

      public ConcurrencyUtils()
  • Method Details

    • 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)
    • runnableToCallable

      public static Callable<?> runnableToCallable(Runnable runnable)