Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top