users@glassfish.java.net

[gf-users] EJB _at_Scheduled are not running for application that are deployed in disabled state

From: Lachezar Dobrev <l.dobrev_at_gmail.com>
Date: Wed, 8 Oct 2014 14:33:03 +0300

  I've come across a behaviour that seems erroneous to me.
  If an application contains a @Stateless that has a @Scheduled method
the schedule is not performed for applications that are deployed
disabled, and then subsequently enabled.

  The attached .war has a single @Stateless with a @Scheduled method
that logs a message every 10 seconds.

  Test case:
  1. Deploy the application in disabled state
    bin/asadmin deploy --enabled=false scheduled.war

  2. Enable the application
    bin/asadmin enable scheduled

  +. Expected behaviour:
    see 'Running' in server log every 10 seconds

  -. Actual behaviour:
    nothing in log



  In contrast when deploying the application enabled:
  1. Deploy the application in enabled state
    bin/asadmin deploy --enabled=false scheduled.war

  +. Expected behavoiur:
    see 'Running' in server log every 10 seconds

  +. Actual behavoiur:
    'Running' shows in log every 10 seconds.

  Deploying in enabled state may be the obvious solution, but an
application might require configuration between deployment and
start-up, and hence it is normal to deploy in disabled state,
configuring and then enabling.