Class AsyncEngineUtils

java.lang.Object
com.luna.common.thread.AsyncEngineUtils

public class AsyncEngineUtils extends Object
Version:
1.0
  • Constructor Details

    • AsyncEngineUtils

      public AsyncEngineUtils()
  • Method Details

    • concurrentExecute

      @SafeVarargs public static <T> List<T> concurrentExecute(Callable<T>... tasks)
      并发执行任务
      Parameters:
      tasks - 任务
      Returns:
      T 任务返回值
    • concurrentExecute

      public static <T> List<T> concurrentExecute(List<Callable<T>> tasks)
      并发执行具有同样返回值的任务
      Parameters:
      tasks - 任务
      Returns:
      T 任务返回值
    • concurrentExecute

      public static <T> List<T> concurrentExecute(long timeout, TimeUnit unit, List<Callable<T>> tasks)
      并发执行超时控制任务; 如果某任务超时或发生其他异常,则该任务返回值为null
      Parameters:
      timeout - 超时时间
      unit - 超时时间单位
      tasks - 任务
      Returns:
      T 任务返回值
    • execute

      public static void execute(Runnable task)
      异步执行任务,不需要返回值
      Parameters:
      task -
    • main

      public static void main(String[] args)
    • destroy

      public static void destroy()