[clarification]: A ManagedExecutorService.submit is called before the application is deployed (e.g. in @Initialized(ApplicationScoped.class) observer #299
Labels
question
Further information is requested
Specification
ManagedExecutorService
I need clarification on ...
What happens and when a task is executed if the task is submitted before the application is fully deployed?
For example, this code is in the application:
The same is for the
@Asynchronous
annotation:I would expect that the message will be logged in a different thread immediately, as soon as the executor can run the task after submitting it, although this could still happen before application is fully loaded and thus not ideal for most cases. Alternatively, the executor could wait until the application is fully deployed and execute the task right after.
I tried both approaches (with executor and
@Asynchrononous
annotation) in GlassFish, and the message was never logged. Probably because the executor isn't ready to take submissions before the app is fully deployed and it lost the submitted task. So I expected the Concurrency TCK doesn't cover this usecase. I also didn't find anything about this case in the specification text.Additional information
I propose that the specification clarifies that the executor should execute tasks submitted during deployment and when. I suggest that the tasks are executed ASAP. We could add another method
submitAfterDeployed
to ensure that the executor waits until the application is deployed before it executes the task.This should also be covered by tests in the TCK to ensure that using an executor during deployment is a valid and portable usecase.
The text was updated successfully, but these errors were encountered: