Is a periodic task created by EE concurrency utilities automatically cancelled during undeployment?
Issue
Periodic tasks created by javax.enterprise.concurrent.ManagedScheduledExecutorService
like the following code are not canceled on undeployment. Is there any workaround?
@ApplicationScoped
public class ScheduledTaskAssigner {
@Resource
ManagedScheduledExecutorService scheduler;
public void newPeriodicTask() {
ScheduledFuture<?> future = scheduler.scheduleWithFixedDelay(() -> {
System.out.println("### run periodic task");
}, 0, 1, TimeUnit.SECONDS);
}
}
Environment
- Red Hat Enterprise Application Platform (JBoss EAP)
- 7
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.