public class RunUtil extends Object
| 构造器和说明 |
|---|
RunUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static CompletableFuture<Void> |
async(Runnable task)
异步执行
|
static <U> CompletableFuture<U> |
async(Supplier<U> task)
异步执行
|
static CompletableFuture<Void> |
asyncAndTry(RunnableEx task) |
static ScheduledFuture<?> |
delay(Runnable task,
long millis)
延迟执行
|
static ScheduledFuture<?> |
delayAndRepeat(Runnable task,
long millis)
延迟执行并重复
|
static <T> Future<T> |
parallel(Callable<T> task)
并行执行
|
static Future<?> |
parallel(Runnable task)
并行执行
|
static void |
runAndTry(RunnableEx task)
运行并吃掉异常
|
static void |
runOrThrow(RunnableEx task)
运行或异常
|
static ScheduledFuture<?> |
scheduleAtFixedRate(Runnable task,
long initialDelay,
long millisPeriod)
定时任务
|
static ScheduledFuture<?> |
scheduleWithFixedDelay(Runnable task,
long initialDelay,
long millisDelay)
定时任务
|
static void |
setAsyncExecutor(ExecutorService asyncExecutor) |
static void |
setParallelExecutor(ExecutorService parallelExecutor) |
static void |
setScheduledExecutor(ScheduledExecutorService scheduledExecutor) |
public static void setScheduledExecutor(ScheduledExecutorService scheduledExecutor)
public static void setParallelExecutor(ExecutorService parallelExecutor)
public static void setAsyncExecutor(ExecutorService asyncExecutor)
public static void runOrThrow(RunnableEx task)
public static void runAndTry(RunnableEx task)
public static CompletableFuture<Void> async(Runnable task)
public static <U> CompletableFuture<U> async(Supplier<U> task)
public static CompletableFuture<Void> asyncAndTry(RunnableEx task)
public static ScheduledFuture<?> delay(Runnable task, long millis)
public static ScheduledFuture<?> delayAndRepeat(Runnable task, long millis)
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long initialDelay, long millisPeriod)
public static ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long millisDelay)
Copyright © 2024. All rights reserved.