Re: NSTimer replacement?
Re: NSTimer replacement?
- Subject: Re: NSTimer replacement?
- From: Johann Werner <email@hidden>
- Date: Wed, 9 May 2007 13:03:01 +0200
Thanks for all replies. I guessed already that there had to be any
means by Java that explained the deprecation of NSTimer.
Am 09.05.2007 um 12:05 schrieb Oliver Egger:
Hi jw
we use the open source quartz scheduling functionality:
http://www.opensymphony.com/quartz/
looks interesting though I think I will stick to doing it the
standard java way
you define jobs similiar to the syntax of a cronjob. to use it a
small example:
private SchedulerFactory schedulerFactory = new
StdSchedulerFactory();
private Scheduler scheduler = schedulerFactory.getScheduler();
scheduler.start();
and then:
JobDetail jobDetail = new JobDetail("DocumentCleanJob",
Scheduler.DEFAULT_GROUP, DocumentCleanJob.class);
CronTrigger cronTrigger = new CronTrigger("DocumentCleanJob",
Scheduler.DEFAULT_GROUP, "DocumentCleanJob",
Scheduler.DEFAULT_GROUP, "0 0 6/12 * * ?");
scheduler.scheduleJob(jobDetail, cronTrigger);
The only issues we had with webobjects are to bring the
quarz.properties file into the classpath and also the consequence that
if you have multiple instances you will also have multiple schedulers
I thought of an extra database table with an entry to mark if an
instance is already managing the schedule so when a new instance is
started it doesn't set up another one.
Sure if the actual schedule-handling instance crashes and doesn't
check out that database entry I have a problem but I think my
programming skills are well enough to exclude that scenario ;)
jw
...
oliver
On 5/9/07, Johann Werner <email@hidden> wrote:
I recently looked at the NSTimer documentation where a note came up
stating that it is obsolete and should not be used for new
development. Unfortunately there is no mention of alternatives.
I have a WO app running that should execute a function at certain
dates automagically ;) More precisely: people can register for an
event and put in different information. At a certain date (to make
sense a couple of days ahead of the event) the app should check if
all mandatory information has been entered and sends a reminder email
to that person if not.
By searching the web the only way if found to implement such
behaviour is using a cronjob with wget and a direct action. But by
this the app loses control of when the action gets called as it is
hardcoded. Additionally I would have to add this call manually in a
system config file. I think that's no good as it is not directly
related to the app and therefore adds to the install/maintenance
complexitiy.
What is the common practice to implement such timing needs?
jw
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden