Is a periodic task created by EE concurrency utilities automatically cancelled during undeployment?

Solution Unverified - Updated -

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.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content