-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
8.0 Update 7
-
None
-
False
-
-
False
-
-
-
-
-
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
-
JBEAP-30375 [GSS](8.1.z) WFLY-20727 - ManagedScheduledExecutorService unexpectedly executes tasks multiple times
-
- Verified
-
- is incorporated by
-
JBEAP-30561 (8.0.z) Bump org.glassfish:jakarta.enterprise.concurrent from 3.0.1 to 3.0.2+
-
- New
-