[jboss-jira] [JBoss JIRA] (WFLY-5863) EE concurency should queue scheduled tasks, instead of failing on timeout

James Olsen (JIRA) issues at jboss.org
Tue Feb 16 05:41:00 EST 2016


    [ https://issues.jboss.org/browse/WFLY-5863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13163410#comment-13163410 ] 

James Olsen commented on WFLY-5863:
-----------------------------------

I think the determination of when the server is 'suspended' is also flawed.  I have a {{@Singleton}} {{@Startup}} EJB with a {{@Resource ManagedScheduledExecutorService managedScheduledExecutorService;}} that starts a scheduled task in the {{@PostConstruct}} method.  During server shutdown I am getting the following error *BEFORE* the completion of the EJB's {{@PreDestroy}} method (which amongst other things cancels the task):

{noformat}ERROR [org.jboss.as.ee] (EE-ManagedScheduledExecutorService-default-Thread-3) WFLYEE0110: Failed to run scheduled task: java.lang.IllegalStateException: WFLYEE0111: Cannot run scheduled task javax.enterprise.concurrent.ManagedExecutors$ManagedRunnable at b16ffc9 as container is suspended
	at org.jboss.as.ee.concurrent.ControlPointUtils$ControlledScheduledRunnable.run(ControlPointUtils.java:164)
	at org.jboss.as.ee.concurrent.ControlPointUtils$ControlledManagedRunnable.run(ControlPointUtils.java:246)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at org.glassfish.enterprise.concurrent.internal.ManagedScheduledThreadPoolExecutor$ManagedScheduledFutureTask.access$201(ManagedScheduledThreadPoolExecutor.java:383)
	at org.glassfish.enterprise.concurrent.internal.ManagedScheduledThreadPoolExecutor$ManagedScheduledFutureTask.run(ManagedScheduledThreadPoolExecutor.java:534)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
	at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250){noformat}

As I have declared a dependency on the {{ManagedScheduledExecutorService}}, shouldn't it remain useable until the EJB's {{@PreDestroy}} method has completed?

> EE concurency should queue scheduled tasks, instead of failing on timeout
> -------------------------------------------------------------------------
>
>                 Key: WFLY-5863
>                 URL: https://issues.jboss.org/browse/WFLY-5863
>             Project: WildFly
>          Issue Type: Feature Request
>          Components: EE
>            Reporter: Stuart Douglas
>            Assignee: James Perkins
>
> At the moment if a scheduled task is queued and its execution happens when the server is suspended then the task will fail with an exception. It would be better if this was queued as with EJB timers.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list