I forked the spring-boot2-demo repo to this
Did these changes :
BackendBController.java
@GetMapping("futureTimeout")
public String futureTimeout(){
for(int i=0; i< 1000; i++){
executeAsyncWithFallback(this::timeout, this::fallback);
}
return "Something";
}
I invoked the /futureTimeout
endpoint in BackedBController
I see this in JVisualVM
I am trying to understand if this the expected behavior i.e. Once the job is complete will threads remain active? Shouldn't they be closed?
From https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.html
corePoolSize
number of threads will always be active once the threadpool is created. It's only the excessmaximumPoolSize-corePoolSize
that will be created & destroyed after completion of the tasks.