Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Scheduling Pls Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Scheduling Pls Help" Watch "Scheduling Pls Help" New topic
Author

Scheduling Pls Help

allen turner
Greenhorn

Joined: Oct 04, 2001
Posts: 15
Hai
I want to update a database on a daily basis using java at some predefined times of the day. is this possible? What i am looking at is some kind of a cron job like facility like in linux.
Thanks
Bye
Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
just a idea,
have a cron runs a shell script which runs java program.
or just have a perl or shell script do it directly.
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
For any UNIX system you can write a cron job as specifed in the previous reply. If u use windows NT then create a new scheduled task to invoke a batch file which invokes Java.
------------------
Shubhrajit


Shubhrajit
allen turner
Greenhorn

Joined: Oct 04, 2001
Posts: 15
Thanks!
But i want to do it from java so that i need not depend on the facility given by the platform like NT or linux. if i can do it in java no matter waht the platform it will work!!. So i specifically need it in java.
Bye
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Of course you can do this, and event handling is the way to do it. Think about it this way: you have a Cron object (hey why not, the word's not copyrighted) that will tell other objects when a time they have expressed interest in comes around. When it happens, the Cron class creates a TimedEvent object, and sends it as a parameter to a Listener that knows what job needs to be performed.
For a task like this you don't really need OS services. Your VM does, of course, but that's already built into it.
Is that enough to go on?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
allen turner
Greenhorn

Joined: Oct 04, 2001
Posts: 15
Thanks
I think i can work on that idea. Is there any useful jars that can do all this kind of things?
Thanks
Chidda
Greenhorn

Joined: Jan 06, 2002
Posts: 1
Allen,
JDK1.3 exposes couple of classes java.util.Timer and java.util.TimerTask that actually does the job of Scheduling (It is rudimentary thread based implementation). It is pretty simple to build a robust client around Timer and TimerTask.
Hope this helps.
Chidda
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Scheduling Pls Help
 
Similar Threads
Took the test today
A funny
IBM Rational Functional tester: someone know it????
FTP IDE
Diffrent Excpetion thrown by Data class constructor & methods