I work on a simulation system, where at each timestep, I have to simulate many models. I used a FixedThreadPool to speed up the calculation:
ExecutorService executor = Executors.newFixedThreadPool(nThread);
for (Model m : models) {
executor.execute( m.simulationTask() );
}
executor.shutdown();
while ( ! executor.awaitTermination(10, TimeUnit.MINUTES) ) {
System.out.println("wait");
}
Now, the executor can't be used to execute()
new Tasks after calling shutdown()
. Is there a way to reset the executor, so I can reuse the existing executor (and its threads) at the next simulation step?