users@glassfish.java.net

Re: scheduled method stops running

From: NBW <emailnbw_at_gmail.com>
Date: Mon, 4 Oct 2010 12:41:58 -0400

Since I was the OP of the thread referenced below I thought I'd drop a
follow up here. 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.

To work around this in 3.0 I removed all usage of @Schedule and replaced it
with usage of Executor.scheduleAtFixedRate(...). I now have a Runnable that
contains the business logic the @Schedule method was executing which is
executed at the required interval by the Executor. The Executor and the
Future task that it returns are properties of a Singleton Startup bean
and initialized in the bean's @PostConstruct method. It's a lot of extra
work/code compared to @Scheduled, but more importantly its reliable.

-Noah



On Fri, Oct 1, 2010 at 3:41 PM, Glenn Holmer <gholmer_at_weycogroup.com> wrote:

> On Fri, 2010-10-01 at 11:32 -0700, Marina Vatkina wrote:
> > Glenn Holmer wrote:
> > > On Fri, 2010-10-01 at 10:10 -0700, Marina Vatkina wrote:
> > >
> > >> There should be error messages in the log.
>
> We're finding this thread helpful, thanks:
>
> http://forums.java.net/jive/thread.jspa?messageID=483269
>
> --
> ____________________________________________________________
> Glenn Holmer gholmer_at_weycogroup.com
> Software Engineer phone: 414-908-1809
> Weyco Group, Inc. fax: 414-908-1601
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>


-- 
"Computers are fast. They just take longer."