-
Bug
-
Resolution: Obsolete
-
Major
-
8.1.0.Final
-
None
The ManagedScheduledExecutorService can permanently abort a given fixed-rate task if the task is executed by multiple executor threads concurrently.
The resulting error is:
SEVERE [org.glassfish.enterprise.concurrent] EE-ManagedScheduledExecutorService-default-Thread-x) java.lang.NullPointerException.
The error occurs in org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl.run().
Once this error occurs, the task will not execute again.
This is clearly not a typical condition as one would generally expect the ManagedScheduledExecutorService to be used to support tasks where the execution interval is much longer than the time taken to execute the task, thus we would not normally expect multiple threads to execute the task concurrently. However one could imagine conditions under which this might occur, for example if the task execution was slowed by some unusual system load condition. In any case it seems reasonable to expect this condition should fail gracefully in a way that does not permanently prevent all future executions of the scheduled task.
Note that tasks submitted using scheduleWithFixedDelay do not seem subject to this issue, presumably because the executor service waits for completion of each task and thus does not end up in a concurrent execution situation.