开发者

Can Guava's AbstractExecutionThreadService be reused?

开发者 https://www.devze.com 2023-03-26 06:18 出处:网络
As far as I can tell, once the run() method of AbstractExecutionThreadService stops, it can\'t be started again. Is that correct?

As far as I can tell, once the run() method of AbstractExecutionThreadService stops, it can't be started again. Is that correct?

I have a service that extends AbstractExecutionThreadService. In my tests I want to start this service, use it, stop it, then start it again. Any suggestions what I开发者_StackOverflow社区 can/should do to achieve this while using AbstractExecutionThreadService or AbstractService?


Service.start() states that a stopped Service may not be restarted. I'd say just create a new instance of your service and start it each time.

0

精彩评论

暂无评论...
验证码 换一张
取 消