private final ExecutorService pool = Executors.newFixedThreadPool(5);
for (ProductInfo prod : product) {
pool.execute(new Runnable() {
@Override
public void run() {
try {
prod.checkout(processList);
} catch (InterruptedException e) {
log.error("PRODUCT INFO EXCEPTION", e);
}
}
});
}
All calls to prod.checkout method call different apis having no correlation between them.
ProductInfo.java
@Async
public void checkout(List<ProcessLog> list) throws InterruptedException {
process = processUtil.start(getHome(), job);
list.add(process);
preprocess();
execute();
postprocess();
list.remove(process);
processUtil.end(process);
}
At any time i see only two threads running, what can i do to make 5 threads running at any time?