程序包 cn.godmao.utils

类 ExecutorUtil

java.lang.Object
cn.godmao.utils.ExecutorUtil

public class ExecutorUtil extends Object
  • 构造器详细资料

    • ExecutorUtil

      public ExecutorUtil()
  • 方法详细资料

    • newSingleThreadExecutor

      public static ExecutorService newSingleThreadExecutor(String namePrefix)
      创建单个线程执行器
      参数:
      namePrefix - 线程名
      返回:
      执行器
    • newSingleThreadExecutor

      public static ExecutorService newSingleThreadExecutor(ThreadFactory threadFactory)
      创建单个线程执行器
      参数:
      threadFactory - 线程创建工厂
      返回:
      执行器
    • newCacheThreadPool

      public static ExecutorService newCacheThreadPool(String namePrefix)
      创建线程池
      参数:
      namePrefix - 线程名
      返回:
      执行器
    • newCacheThreadPool

      public static ExecutorService newCacheThreadPool(ThreadFactory threadFactory)
      线程池
      参数:
      threadFactory - 线程创建工厂
      返回:
      执行器
    • newFixedThreadPool

      public static ExecutorService newFixedThreadPool(int corePoolSize, ThreadFactory threadFactory)
      创建固定大小线程执行器
      参数:
      corePoolSize - 容量
      threadFactory - 线程工厂
      返回:
      执行器
    • newFixedThreadPool

      public static ExecutorService newFixedThreadPool(int corePoolSize, String namePrefix)
      创建固定大小线程执行器
      参数:
      corePoolSize - 容量
      namePrefix - 线程名
      返回:
      执行器
    • newSingleScheduled

      public static ScheduledExecutorService newSingleScheduled(ThreadFactory threadFactory)
      创建单个线程调度执行器
      参数:
      threadFactory - 线程创建工厂
      返回:
      调度 执行器
    • newSingleScheduled

      public static ScheduledExecutorService newSingleScheduled(String namePrefix)
      创建单个线程调度执行器
      参数:
      namePrefix - 线程名
      返回:
      调度 执行器
    • newScheduled

      public static ScheduledExecutorService newScheduled(int corePoolSize, String namePrefix)
      创建指定数量 - 的线程调度执行器
      参数:
      corePoolSize - 容量
      namePrefix - 线程名
      返回:
      指定数量的 调度 执行器
    • newScheduled

      public static ScheduledExecutorService newScheduled(int corePoolSize, ThreadFactory threadFactory)
      创建指定数量 - 的线程调度执行器
      参数:
      corePoolSize - 容量
      threadFactory - 线程创建工厂
      返回:
      指定数量的 调度 执行器
    • createThreadFactory

      public static ThreadFactory createThreadFactory(String namePrefix)
      创建 线程工厂
           daemon 参数默认是 true
       
      参数:
      namePrefix - 线程名
      返回:
      线程工厂
    • createThreadFactory

      public static ThreadFactory createThreadFactory(String namePrefix, boolean daemon)
      创建线程工厂
      参数:
      namePrefix - 线程名前缀
      daemon - 置是否守护线程
      返回:
      线程工厂