문제

I am currently modifying an application to use a ScheduledExecutorService in place of a Timer and I don't know what to do with my old Timer.purge().

How are things handled with an Executor? Do I have to worry about anything?

도움이 되었습니까?

해결책

There is no equivalent for the Executor. When tasks are cancelled their reference will be removed from the Executor.

However the lifecycle of the Executor is managed with shutdown() so you should call that when the Executor is no longer required.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top