This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running java application in background

 
Srikrishna DhumalRao
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to develop a java application which runs in the backround continuosly monitors the database and sends mail to the concerned persons depending on the work status(pending/testing/etc).Kindly let me know how to achieve it.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What OS?
What do you have so far?
 
Srikrishna DhumalRao
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a Win2000 OS . Actually it is a defect tracking tool, I have to design an escalation module , which has to generarte mails to the upper hirerachy depending on the priority,severity and maximum allotted time for the defect.I wanted this to run continuosly communicating with the database and send mails.I completed mail generator program which runs when ever I run the program , but I wanted it to run continously in the background.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just need a loop that will run forever ... or until you tell it to stop. I'd put it in the run method of a class that implements Runnable.

You might need to find a way to interrupt the wait on the runnable to make it exit right away.

Does that give you enough to start? If you can run this as a service under Windows you won't need the readline and stop ... you can just stop the service.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
be sure to use sleep and wait, etc. so that the loop only executes code when there is something for it to do.
 
Srikrishna DhumalRao
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I got it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic