Class ConcurrencyUtil


  • public class ConcurrencyUtil
    extends Object
    Author:
    cdr
    • Constructor Detail

      • ConcurrencyUtil

        public ConcurrencyUtil()
    • Method Detail

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