ManagedExecutorService does not execute tasks when enabling application.

43 views
Skip to first unread message

igayimotukat

unread,
Jan 22, 2018, 6:21:28 AM1/22/18
to Payara Forum
Hi,

ManagedExecutorService does not execute tasks when enabling application.


Steps to reproduce
1. Build the following Appilication. ``mvn clean package``
2. Deploy application. ``bin/asadmin deploy --contextroot=test-app --name=test-app --virtualservers=server test-app.war``
  -> MyTask was executed.
3. Disable application with asadmin. ``bin/asadmin disable test-app``
4. Enable application with asadmin. ``bin/asadmin enable test-app``
  -> MyTask was not executed.


Is there any way to run MyTask when enabling application?

Payara Server 5 - Beta 1
Java 1.8.0_151

Ondrej Mihályi

unread,
Jan 22, 2018, 6:24:26 AM1/22/18
to igayimotukat, Payara Forum
Hi, the code looks fine to me. Would you please raise this as an issue on github? https://github.com/payara/Payara/issues/

Ondro

--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/80660ea5-2c82-4348-916c-db2c1f183f20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ondrej Mihályi

unread,
Jan 22, 2018, 6:31:10 AM1/22/18
to igayimotukat, Payara Forum
If your servlet listener isn't even triggered, then you can put the startup code into a CDI startup bean:

@ApplicationScoped
public class StartUp {
  public void start(@Observes @Initialized(ApplicationScoped.class) ServletContext event) {
    // do something with executor service
  }
}

If your servlet listener is triggered but the executor won't run your task, there are not many options to run the task. You can try running it with asynchronous EJB method, but executor service is much superior than that.

Ondro

igayimotukat

unread,
Jan 22, 2018, 6:50:48 AM1/22/18
to Payara Forum
Hi,

Reported on github.


2018年1月22日月曜日 20時24分26秒 UTC+9 Ondro Mihályi:
Hi, the code looks fine to me. Would you please raise this as an issue on github? https://github.com/payara/Payara/issues/

Ondro
2018-01-22 12:21 GMT+01:00 igayimotukat <otukat...@gmail.com>:
Hi,

ManagedExecutorService does not execute tasks when enabling application.


Steps to reproduce
1. Build the following Appilication. ``mvn clean package``
2. Deploy application. ``bin/asadmin deploy --contextroot=test-app --name=test-app --virtualservers=server test-app.war``
  -> MyTask was executed.
3. Disable application with asadmin. ``bin/asadmin disable test-app``
4. Enable application with asadmin. ``bin/asadmin enable test-app``
  -> MyTask was not executed.


Is there any way to run MyTask when enabling application?

Payara Server 5 - Beta 1
Java 1.8.0_151

--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.

Mike Croft

unread,
Mar 26, 2018, 10:15:13 AM3/26/18
to Payara Forum
Fixed with PAYARA-2430
Reply all
Reply to author
Forward
0 new messages