public class ThreadPoolUtils extends Object
| 限定符和类型 | 类和说明 |
|---|---|
private static class |
ThreadPoolUtils.SingletonHolder |
| 限定符和类型 | 字段和说明 |
|---|---|
private ScheduledThreadPoolExecutor |
scheduledThreadPoolExecutor |
private ThreadPoolExecutor |
threadPoolExecutor |
| 限定符 | 构造器和说明 |
|---|---|
private |
ThreadPoolUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
execute(Runnable runnable) |
static ThreadPoolUtils |
getInstance() |
ScheduledFuture |
scheduleAtFixedRate(Runnable runnable,
long period) |
ScheduledFuture |
scheduleAtFixedRate(Runnable runnable,
long initialDelay,
long period,
TimeUnit timeUnit) |
ScheduledFuture |
scheduleWithFixedDelay(Runnable runnable,
long period) |
ScheduledFuture |
scheduleWithFixedDelay(Runnable runnable,
long initialDelay,
long period,
TimeUnit timeUnit) |
Future<?> |
submit(Runnable runnable) |
private ThreadPoolExecutor threadPoolExecutor
private ScheduledThreadPoolExecutor scheduledThreadPoolExecutor
public static ThreadPoolUtils getInstance()
public void execute(Runnable runnable)
public ScheduledFuture scheduleAtFixedRate(Runnable runnable, long period)
runnable - period - 单位: 毫秒public ScheduledFuture scheduleAtFixedRate(Runnable runnable, long initialDelay, long period, TimeUnit timeUnit)
runnable - initialDelay - period - timeUnit - public ScheduledFuture scheduleWithFixedDelay(Runnable runnable, long period)
runnable - period - 单位: 毫秒public ScheduledFuture scheduleWithFixedDelay(Runnable runnable, long initialDelay, long period, TimeUnit timeUnit)
runnable - initialDelay - period - timeUnit - Copyright © 2020. All rights reserved.