Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top