Wednesday, 12 August 2015

rejected from java.util.concurrent.ScheduledThreadPoolExecutor

After you shutdown an ScheduledThreadPoolExecutor you can't execute any schedule any more.

Otherwise you will get this error.

You can do this check to create a new one:

if (scheduledThreadPoolExecutor.isShutdown()) {
    scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1);

Or you can cancel the schedule by: thread.cancel()   but this function sometime doesn't work....

No comments:

Post a comment