他们是一种使用 ExecutorService 来安排线程池的方法吗,类似于 thread.sleep()
我当前的代码看起来像
Executors.newScheduledThreadPool(poolSize);
public void run() {
try {
pool.execute(new Worker());
}
但我想调用 run 方法,只有在一段时间间隔之后。有人可以让我知道该怎么做吗?
他们是一种使用 ExecutorService 来安排线程池的方法吗,类似于 thread.sleep()
我当前的代码看起来像
Executors.newScheduledThreadPool(poolSize);
public void run() {
try {
pool.execute(new Worker());
}
但我想调用 run 方法,只有在一段时间间隔之后。有人可以让我知道该怎么做吗?