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: 1241
posted
0
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
posted
0
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
posted
0
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
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
posted
0
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
posted
0
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
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.