File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Scheduler in Java Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Scheduler in Java Application " Watch "Scheduler in Java Application " New topic

Scheduler in Java Application

saiprasad raut
Ranch Hand

Joined: Aug 29, 2003
Posts: 40
HI All,

I am working on a project in which client will schedule that he want a perticular report to be mailed to him according to the schedule he set.

Lets take an example:
Client schedules REPORT1 to be mailed to him after every week( lets say every monday)

I am maintaining a column in my SQL server 2000 database as 'Next_Runnung_Date' .

I have 2 optoins:
1. I will write a SQL job which will daily run and check the 'Next_Run_Date' column. If this matches the server current date then it should call the Java Class (But i dont know how can i call Java Class with parameter from SQL server 2000)

2. Write a Java Class (with threads) this thread will sleep for 24 hrs and after 24 hrs it will wake up and go to the database check the 'Next_running_date' column and accordingly call the other java class......
(But due to the thread will affect my server performance...)

IS there any ohter way to do? is anybody of you have came across such situations before???

Please let me know...
Thanks in advance...

zmarak ahmad djan

Joined: Sep 02, 2004
Posts: 20
java.util.Timer is not costly
(but I have never used it with such a wide gap ... have a try)

zmarak (publican)
Abhi Yadav

Joined: Sep 09, 2004
Posts: 6
U can refer a java API for scheduling the jobs
check this link
zmarak ahmad djan

Joined: Sep 02, 2004
Posts: 20
therer are also schedulers in java.util.concurrent packages in J2SE5
but wait until next year
saiprasad raut
Ranch Hand

Joined: Aug 29, 2003
Posts: 40
Thank you all for your replies!!!

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Look at Flux if you evaluate a set of commercial schedulers. They have persistent timers that reside in the database when you shut down and come back to life when you start up again. Oh, wait, that may be our application doing that.
[ September 10, 2004: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Caesar Dutta
Ranch Hand

Joined: Sep 18, 2004
Posts: 30
If I am not mistaken a Java program can be converted to exe. There are
some utilities I believe at So if I write a program and
then schedule it through the windows schedular is there a problem ?

Kindly let me know.


Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

There is a api, called 'quarz' or 'quartz', where you may schedule multiple jobs in a crontab - manner.

Cesar: why do you need to convert the program to exe, to run it by the windows-scheduler?

Sorry Abhi Yadav, you mentioned quartz, inclusive link - have overseen it.
[ September 24, 2004: Message edited by: Stefan Wagner ]
I agree. Here's the link:
subject: Scheduler in Java Application
It's not a secret anymore!