英文:
Resilience4J threads stuck in Running state forever
问题
我fork了spring-boot2-demo仓库到this。
做了以下更改:
BackendBController.java
@GetMapping("futureTimeout")
public String futureTimeout(){
for(int i=0; i<1000; i++){
executeAsyncWithFallback(this::timeout, this::fallback);
}
return "Something";
}
我在BackedBController中调用了/futureTimeout
端点。
我在JVisualVM中看到了这个
我正在尝试理解这是否是预期行为,即一旦工作完成,线程是否仍然保持活动状态?它们不应该被关闭吗?
英文:
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?
答案1
得分: 0
从 https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.html
corePoolSize
表示线程池创建后始终保持活动的线程数量。只有超过 maximumPoolSize-corePoolSize
的额外线程会在任务完成后被创建和销毁。
英文:
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 excess maximumPoolSize-corePoolSize
that will be created & destroyed after completion of the tasks.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论