-
Bug
-
Resolution: Done
-
Major
-
8.1.0.Beta
-
False
-
-
False
-
-
-
-
-
-
Known Issue
A ManagedScheduledExecutorService unexpectedly executes tasks multiple times.
standalone.xml:
<managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-termination-period="0" hung-task-threshold="60000" keepalive-time="3000"/>
Reproducer app:
import jakarta.annotation.Resource; import jakarta.enterprise.concurrent.CronTrigger; import jakarta.enterprise.concurrent.LastExecution; import jakarta.enterprise.concurrent.ManagedScheduledExecutorService; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.event.Observes; import jakarta.enterprise.event.Startup; import java.time.ZoneId; import java.time.ZonedDateTime; @ApplicationScoped public class DummyBean { @Resource(mappedName = "java:jboss/ee/concurrency/scheduler/default") ManagedScheduledExecutorService executorService; public DummyBean() { } private void onStart(@Observes Startup startup) { System.out.println("Start"); executorService.schedule(() -> something(), new CronTrigger(ZoneId.systemDefault()) { @Override public ZonedDateTime getNextRunTime(LastExecution lastExecutionInfo, ZonedDateTime taskScheduledTime) { ZonedDateTime nextRunTime = super.getNextRunTime(lastExecutionInfo, taskScheduledTime); System.out.println("ZonedDateTime getNextRunTime " + nextRunTime); return nextRunTime; } }.hours("*").minutes("*").seconds("*/10")); } private void something() { System.out.println("something"); } }
The following log is printed.
Please notice the "duplicate" executions at 11:33:50.
Apparently the internal compution of the next execution sometimes returns the same value as for the prevoius execution (see log above).
- clones
-
WFLY-20727 ManagedScheduledExecutorService unexpectedly executes tasks multiple times
-
- Resolved
-
- is cloned by
-
JBEAP-30376 [GSS](8.0.z) WFLY-20727 - ManagedScheduledExecutorService unexpectedly executes tasks multiple times
-
- Pull Request Sent
-
- is incorporated by
-
JBEAP-30560 (8.1.z) Upgrade org.glassfish:jakarta.enterprise.concurrent from 3.0.1.redhat-00001 to 3.0.2.redhat-00001
-
- Ready for QA
-