现在,第一
所以,我的问题:
s data and Consume()
线程?我试图做一个错误的方法:在执行Consume()的线程中设置while(true)
,但是Quartz只执行2次,并且ThreadPoolExcetuor已满。填充代码:
public class TestTask extends QuartzJobBean {
private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
2,
2,
60,
TimeUnit.SECONDS,
new LinkedBlockingDeque<>(4));
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) {
threadPoolExecutor.execute(() -> {
//Product()
//data is stored by MessageQueue
});
threadPoolExecutor.execute(() -> {
while (true) {
//Consume()
}
});
}
}