public abstract class ThreadUtils extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ThreadUtils.SerialExecutable
SerialExecutable
|
| 构造器和说明 |
|---|
ThreadUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> void |
benchmark(int nThreads,
int maxPermits,
int loops,
java.util.function.Consumer<Integer> consumer) |
static <T> void |
benchmark(int nThreads,
int maxPermits,
Iterable<T> iterable,
java.util.function.Consumer<T> consumer) |
static ThreadPool |
commonPool() |
static ThreadPool |
commonPool(int maxPoolSize) |
static ThreadPool |
commonPool(int maxPoolSize,
long timeout,
int queueSize) |
static String |
currentThreadName() |
static <T> void |
loop(int nThreads,
int loops,
java.util.function.Consumer<Integer> consumer) |
static <T> void |
loop(int nThreads,
Iterable<T> iterable,
java.util.function.Consumer<T> consumer) |
static void |
notify(Object monitor) |
static void |
notify(Object monitor,
java.util.function.Supplier<Boolean> condition) |
static void |
notifyAll(Object monitor) |
static void |
notifyAll(Object monitor,
java.util.function.Supplier<Boolean> condition) |
static boolean |
randomSleep(long to) |
static boolean |
randomSleep(long from,
long to) |
static Thread |
runAsThread(Runnable runnable) |
static Thread |
runAsThread(Runnable runnable,
Thread.UncaughtExceptionHandler exceptionHandler) |
static Thread |
runAsThread(String name,
Runnable runnable) |
static Thread |
runAsThread(String name,
Runnable runnable,
Thread.UncaughtExceptionHandler exceptionHandler) |
static Thread |
runAsThread(ThreadFactory threadFactory,
Runnable runnable) |
static void |
schedule(Runnable r,
Date date) |
static void |
schedule(Runnable r,
long delay) |
static void |
schedule(Runnable r,
long delay,
TimeUnit timeUnit) |
static Timer |
scheduleAtFixedRate(Executable e,
Date firstTime,
long interval) |
static Timer |
scheduleAtFixedRate(Executable e,
Date firstTime,
long interval,
TimeUnit timeUnit) |
static Timer |
scheduleAtFixedRate(Executable e,
long delay,
long interval) |
static Timer |
scheduleAtFixedRate(Executable e,
long delay,
long interval,
TimeUnit timeUnit) |
static Timer |
scheduleAtFixedRate(Executable e,
long interval,
TimeUnit timeUnit) |
static Timer |
scheduleAtFixedRate(Executable e,
long delay,
TimeUnit delayTimeUnit,
long interval,
TimeUnit intervalTimeUnit) |
static Timer |
scheduleWithFixedDelay(Executable e,
Date firstTime,
long interval) |
static Timer |
scheduleWithFixedDelay(Executable e,
Date firstTime,
long interval,
TimeUnit timeUnit) |
static Timer |
scheduleWithFixedDelay(Executable e,
long delay,
long interval) |
static Timer |
scheduleWithFixedDelay(Executable e,
long delay,
long interval,
TimeUnit timeUnit) |
static Timer |
scheduleWithFixedDelay(Executable e,
long interval,
TimeUnit timeUnit) |
static Timer |
scheduleWithFixedDelay(Executable e,
long delay,
TimeUnit delayTimeUnit,
long interval,
TimeUnit intervalTimeUnit) |
static boolean |
sleep(long ms) |
static boolean |
sleep(long timeout,
TimeUnit timeUnit) |
static boolean |
wait(Object monitor,
java.util.function.Supplier<Boolean> condition) |
static boolean |
wait(Object monitor,
java.util.function.Supplier<Boolean> condition,
long timeout) |
public static boolean randomSleep(long to)
public static boolean randomSleep(long from,
long to)
public static boolean sleep(long timeout,
TimeUnit timeUnit)
public static boolean sleep(long ms)
public static boolean wait(Object monitor, java.util.function.Supplier<Boolean> condition)
public static boolean wait(Object monitor, java.util.function.Supplier<Boolean> condition, long timeout)
public static void notify(Object monitor)
public static void notify(Object monitor, java.util.function.Supplier<Boolean> condition)
public static void notifyAll(Object monitor)
public static void notifyAll(Object monitor, java.util.function.Supplier<Boolean> condition)
public static Thread runAsThread(Runnable runnable, Thread.UncaughtExceptionHandler exceptionHandler)
public static Thread runAsThread(String name, Runnable runnable, Thread.UncaughtExceptionHandler exceptionHandler)
public static Thread runAsThread(ThreadFactory threadFactory, Runnable runnable)
public static String currentThreadName()
public static void schedule(Runnable r, long delay)
public static Timer scheduleAtFixedRate(Executable e, Date firstTime, long interval, TimeUnit timeUnit)
public static Timer scheduleAtFixedRate(Executable e, Date firstTime, long interval)
public static Timer scheduleAtFixedRate(Executable e, long interval, TimeUnit timeUnit)
public static Timer scheduleAtFixedRate(Executable e, long delay, long interval, TimeUnit timeUnit)
public static Timer scheduleAtFixedRate(Executable e, long delay, TimeUnit delayTimeUnit, long interval, TimeUnit intervalTimeUnit)
public static Timer scheduleAtFixedRate(Executable e, long delay, long interval)
public static Timer scheduleWithFixedDelay(Executable e, Date firstTime, long interval, TimeUnit timeUnit)
public static Timer scheduleWithFixedDelay(Executable e, Date firstTime, long interval)
public static Timer scheduleWithFixedDelay(Executable e, long interval, TimeUnit timeUnit)
public static Timer scheduleWithFixedDelay(Executable e, long delay, long interval, TimeUnit timeUnit)
public static Timer scheduleWithFixedDelay(Executable e, long delay, TimeUnit delayTimeUnit, long interval, TimeUnit intervalTimeUnit)
public static Timer scheduleWithFixedDelay(Executable e, long delay, long interval)
public static <T> void loop(int nThreads,
int loops,
java.util.function.Consumer<Integer> consumer)
public static <T> void loop(int nThreads,
Iterable<T> iterable,
java.util.function.Consumer<T> consumer)
public static <T> void benchmark(int nThreads,
int maxPermits,
int loops,
java.util.function.Consumer<Integer> consumer)
public static <T> void benchmark(int nThreads,
int maxPermits,
Iterable<T> iterable,
java.util.function.Consumer<T> consumer)
public static ThreadPool commonPool()
public static ThreadPool commonPool(int maxPoolSize)
public static ThreadPool commonPool(int maxPoolSize, long timeout, int queueSize)
Copyright © 2020. All rights reserved.