users@glassfish.java.net

Re: _at_Schedule job doesn't restart

From: Vetle Roeim <vetler_at_gmail.com>
Date: Thu, 06 Jan 2011 18:41:36 +0100

Hi,

We've encountered the same problem. In our case, I managed to reproduce
it while restarting Glassfish around when the scheduled method was
scheduled to run - this resulted in the scheduled method being removed
completely, and it was only fixable by a redeploy.

There is an earlier discussion about this, I quote:

"The bottom line is that because of the bug where a scheduled task will
be marked as failed if it fails to execute during application shutdown
and thus be removed after two failures @Schedule is unreliable in a
production environment. In my opinion any fix to this in 3.1 should be
back ported into 3.0 as its a serious issue for anyone trying to use it."

It's in the forums here:
http://www.java.net/forum/topic/glassfish/glassfish/scheduled-method-stops-running

This might be what you're experiencing.

Also, make sure your scheduled methods do not throw any exceptions (not
even runtime exceptions, I assume), since two (?) exceptions in a row
will cause the scheduled method to be removed also.

Good luck,
Vetle

On 1/6/11 4:35 PM, Glenn Holmer wrote:
> Occasionally when we restart our app, there is a scheduled job that does
> not run. It's not reproducible and we're not seeing any indication in
> the logs of what might cause this. The job is set up like this:
>
> @Singleton
> public class OrderJobs {
> ...
> @Schedule(minute="0,15,30,45",hour="7-15")
> public void sendOrders() {
> ...
> @Schedule(minute="*",hour="2-15")
> public void updateOrdersFromAcs() {
>
> The second job is the one that sometimes does not start up.
>
> Where should we start looking to try and diagnose this? We are on
> GlassFish 3.0.1, running Java 1.6.0_23.
>


-- 
vr