You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Pugh, Eric" <EP...@MuseumCompany.com> on 2001/12/27 23:53:39 UTC

One Time run of Scheduler Job?

Hi,

I want to be able to queue up a job to run exactly once, sometime in the
future...  I would like to use the Scheduler framework that comes in TDK
2.1...

I can see how I would create a jobentry that maybe was set to sometime in
the next month based on putting in a day_mo value, and populating the min
and hour values.  However, that would cause it to run every month...  I am
using the TurbineNonPersitentSchedulerService, so as long as the server gets
bounced in the next 31 days, I would be in the clear, but is there any other
more elegent way?  

Eric

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: One Time run of Scheduler Job?

Posted by David Wynter <da...@btclick.com>.
I have had to grapple with this and ended up adding a parallel class that
destroys the JobEntry after it has run the once. It does this when the
SchedulerJob subclass associated with the JobEntry runs and tells it to do
it. The user still has a record of the CRON details so can run again by
putting in a new time (in the future) to run and the parallel class
re-creates the Job Entry object.

But this is pretty ugly as keeping a track of whether the related JobEntry
exists or not is a pain.

I think I noticed that you can set some illegal values for some of the CRON
attributes, like day of month is set to 32 and it remains in the database
but does not run, some other time values however cannot be used for this
because the SchedulerService complains. So then you just need the
ScheduledJob subclass to change the oneshot JobEntry CRON attribute value
after running the job to makes sure it does not run again. The only problem
is cleaning up these non running jobs at some point.

Hope this helps

David

-----Original Message-----
From: Pugh, Eric [mailto:EPugh@MuseumCompany.com]
Sent: 27 December 2001 22:54
To: 'Turbine Users List'
Subject: One Time run of Scheduler Job?


Hi,

I want to be able to queue up a job to run exactly once, sometime in the
future...  I would like to use the Scheduler framework that comes in TDK
2.1...

I can see how I would create a jobentry that maybe was set to sometime in
the next month based on putting in a day_mo value, and populating the min
and hour values.  However, that would cause it to run every month...  I am
using the TurbineNonPersitentSchedulerService, so as long as the server gets
bounced in the next 31 days, I would be in the clear, but is there any other
more elegent way?

Eric

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>