Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scheduler in Java Application

 
saiprasad raut
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ..it 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...

Saiprasad
 
zmarak ahmad djan
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.util.Timer is not costly
(but I have never used it with such a wide gap ... have a try)
 
Abhi Yadav
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
U can refer a java API for scheduling the jobs
check this link
www.quartzscheduler.org
 
zmarak ahmad djan
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
therer are also schedulers in java.util.concurrent packages in J2SE5
but wait until next year
 
saiprasad raut
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your replies!!!

Cheers!!
Saiprasad
SCJP1.4
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

http://www.simscomputing.com/products/flux/whitepapers/
[ September 10, 2004: Message edited by: Stan James ]
 
Caesar Dutta
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I am not mistaken a Java program can be converted to exe. There are
some utilities I believe at download.com. So if I write a program and
then schedule it through the windows schedular is there a problem ?

Kindly let me know.

Regards,

Caesar
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic