Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top