Package com.intellij.util
Class ConcurrencyUtil
- java.lang.Object
-
- com.intellij.util.ConcurrencyUtil
-
public class ConcurrencyUtil extends Object
- Author:
- cdr
-
-
Constructor Summary
Constructors Constructor Description ConcurrencyUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
VcacheOrGet(ConcurrentMap<K,V> map, K key, V defaultValue)static <T> List<Future<T>>invokeAll(Collection<Callable<T>> tasks, ExecutorService executorService)invokes and waits all tasks using threadPool, avoiding thread starvation on the waystatic ScheduledThreadPoolExecutornewSingleScheduledThreadExecutor(String threadFactoryName)static ScheduledThreadPoolExecutornewSingleScheduledThreadExecutor(String threadFactoryName, int threadPriority)static ThreadPoolExecutornewSingleThreadExecutor(String threadFactoryName)static ThreadPoolExecutornewSingleThreadExecutor(String threadFactoryName, int threadPriority)
-
-
-
Method Detail
-
invokeAll
public static <T> List<Future<T>> invokeAll(@NotNull Collection<Callable<T>> tasks, ExecutorService executorService) throws Throwable
invokes and waits all tasks using threadPool, avoiding thread starvation on the way- Throws:
Throwable
-
cacheOrGet
@NotNull public static <K,V> V cacheOrGet(@NotNull ConcurrentMap<K,V> map, @NotNull K key, @NotNull V defaultValue)- Returns:
- defaultValue if there is no entry in the map (in that case defaultValue is placed into the map), or corresponding value if entry already exists
-
newSingleThreadExecutor
@NotNull public static ThreadPoolExecutor newSingleThreadExecutor(@NotNull @NonNls String threadFactoryName)
-
newSingleThreadExecutor
@NotNull public static ThreadPoolExecutor newSingleThreadExecutor(@NotNull String threadFactoryName, int threadPriority)
-
newSingleScheduledThreadExecutor
@NotNull public static ScheduledThreadPoolExecutor newSingleScheduledThreadExecutor(@NotNull @NonNls String threadFactoryName)
-
newSingleScheduledThreadExecutor
@NotNull public static ScheduledThreadPoolExecutor newSingleScheduledThreadExecutor(@NotNull String threadFactoryName, int threadPriority)
-
-