public final class ThreadUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ThreadUtils.DefaultFutureResultFilter<T> |
static interface |
ThreadUtils.IFutureResultFilter<T>
执行结果过滤器
|
Constructor and Description |
---|
ThreadUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
executeOnce(Callable<T> worker) |
static <T> T |
executeOnce(Callable<T> worker,
long timeout) |
static <T> T |
executeOnce(Callable<T> worker,
long timeout,
int reAwaitTimes,
ThreadUtils.IFutureResultFilter<T> resultFilter) |
static <T> T |
executeOnce(Callable<T> worker,
long timeout,
ThreadUtils.IFutureResultFilter<T> resultFilter) |
static <T> List<T> |
executeOnce(List<Callable<T>> workers) |
static <T> List<T> |
executeOnce(List<Callable<T>> workers,
long timeout) |
static <T> List<T> |
executeOnce(List<Callable<T>> workers,
long timeout,
int reAwaitTimes,
ThreadUtils.IFutureResultFilter<T> resultFilter) |
static <T> List<T> |
executeOnce(List<Callable<T>> workers,
long timeout,
ThreadUtils.IFutureResultFilter<T> resultFilter) |
static ExecutorService |
newCachedThreadPool() |
static ExecutorService |
newCachedThreadPool(int maximumPoolSize) |
static ExecutorService |
newCachedThreadPool(int maximumPoolSize,
long keepAliveTime) |
static ExecutorService |
newCachedThreadPool(int maximumPoolSize,
long keepAliveTime,
ThreadFactory threadFactory) |
static ExecutorService |
newCachedThreadPool(ThreadFactory threadFactory) |
static ExecutorService |
newFixedThreadPool(int nThreads) |
static ExecutorService |
newFixedThreadPool(int nThreads,
int queueCapacity) |
static ExecutorService |
newFixedThreadPool(int nThreads,
int queueCapacity,
ThreadFactory threadFactory) |
static ScheduledExecutorService |
newScheduledThreadPool(int corePoolSize) |
static ScheduledExecutorService |
newScheduledThreadPool(int corePoolSize,
ThreadFactory threadFactory) |
static ScheduledExecutorService |
newScheduledThreadPool(int corePoolSize,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) |
static ExecutorService |
newSingleThreadExecutor() |
static ExecutorService |
newSingleThreadExecutor(int queueCapacity) |
static ExecutorService |
newSingleThreadExecutor(int queueCapacity,
ThreadFactory threadFactory) |
static ScheduledExecutorService |
newSingleThreadScheduledExecutor() |
static ScheduledExecutorService |
newSingleThreadScheduledExecutor(ThreadFactory threadFactory) |
static ExecutorService |
newThreadExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime) |
static ExecutorService |
newThreadExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
int queueCapacity) |
static ExecutorService |
newThreadExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
int queueCapacity,
ThreadFactory threadFactory) |
static ExecutorService |
newThreadExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
int queueCapacity,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) |
static void |
shutdownExecutorService(ExecutorService executorService,
long timeout,
int reAwaitTimes) |
public static ExecutorService newThreadExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime)
public static ExecutorService newThreadExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, int queueCapacity)
public static ExecutorService newThreadExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, int queueCapacity, ThreadFactory threadFactory)
public static ExecutorService newThreadExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, int queueCapacity, ThreadFactory threadFactory, RejectedExecutionHandler handler)
public static ExecutorService newSingleThreadExecutor()
public static ExecutorService newSingleThreadExecutor(int queueCapacity)
public static ExecutorService newSingleThreadExecutor(int queueCapacity, ThreadFactory threadFactory)
public static ScheduledExecutorService newSingleThreadScheduledExecutor()
public static ScheduledExecutorService newSingleThreadScheduledExecutor(ThreadFactory threadFactory)
public static ExecutorService newCachedThreadPool()
public static ExecutorService newCachedThreadPool(int maximumPoolSize)
public static ExecutorService newCachedThreadPool(ThreadFactory threadFactory)
public static ExecutorService newCachedThreadPool(int maximumPoolSize, long keepAliveTime)
public static ExecutorService newCachedThreadPool(int maximumPoolSize, long keepAliveTime, ThreadFactory threadFactory)
public static ExecutorService newFixedThreadPool(int nThreads)
public static ExecutorService newFixedThreadPool(int nThreads, int queueCapacity)
public static ExecutorService newFixedThreadPool(int nThreads, int queueCapacity, ThreadFactory threadFactory)
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize)
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, ThreadFactory threadFactory)
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler)
public static <T> T executeOnce(Callable<T> worker) throws InterruptedException, ExecutionException
public static <T> T executeOnce(Callable<T> worker, long timeout) throws InterruptedException, ExecutionException
public static <T> T executeOnce(Callable<T> worker, long timeout, ThreadUtils.IFutureResultFilter<T> resultFilter) throws InterruptedException, ExecutionException
public static <T> T executeOnce(Callable<T> worker, long timeout, int reAwaitTimes, ThreadUtils.IFutureResultFilter<T> resultFilter) throws InterruptedException, ExecutionException
public static <T> List<T> executeOnce(List<Callable<T>> workers) throws InterruptedException, ExecutionException
public static <T> List<T> executeOnce(List<Callable<T>> workers, long timeout) throws InterruptedException, ExecutionException
public static <T> List<T> executeOnce(List<Callable<T>> workers, long timeout, ThreadUtils.IFutureResultFilter<T> resultFilter) throws InterruptedException, ExecutionException
public static <T> List<T> executeOnce(List<Callable<T>> workers, long timeout, int reAwaitTimes, ThreadUtils.IFutureResultFilter<T> resultFilter) throws InterruptedException, ExecutionException
public static void shutdownExecutorService(ExecutorService executorService, long timeout, int reAwaitTimes)
Copyright © 2022. All rights reserved.