gpt4 book ai didi

java - 抽象计划服务 : shutdown underlying executor

转载 作者:行者123 更新时间:2023-11-29 08:09:41 27 4
gpt4 key购买 nike

我正在尝试使用来自 google guava 库的 AbstractScheduledService。在 the docs for this class我看到以下内容:

The executor will not be shutdown when this service stops.

为什么我们要在停止服务后让执行线程保持 Activity 状态?对我来说,这似乎是一个非常奇怪的架构决定。我错过了什么?

最佳答案

您可以将执行程序用于多种服务(因为它只提供线程来执行您的代码,而无需任何领域知识)。这就是为什么在停止 ScheduledService 时不停止执行程序是有意义的

关于java - 抽象计划服务 : shutdown underlying executor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8878725/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com