On local machine, I have a runnable task which I am cancelling using future.cancel(true), which returns true and I see ThreadPoolTaskExecutor has no pending tasks.
However on a different environment (which is a container), I see future.cancel(true) return true, but ThreadPoolTaskExecutor does not accept new tasks, because previous tasks are not cancelled.
Any ideas why this can happen? Here is what I'm doing.
Task task = new Task();
Future<String> future = threadPoolTaskExecutor.submit(task);
// wait for some time
boolean val = future.cancel(true)
// still cannot submit more tasks
private class Task implements Callable<String> {
@Override
public String call() throws InterruptedException {
Thread.sleep(10000);
return "value";
}
}