Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Background stored procedure call  RSS feed

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Thanks in advance.
I have a doubt/requirement that, we are using struts as a frame work in our web appllication,and there is one procedure which should be called for every 15 minutes to check some status of one column of table, and depending upon that i have to send some alert to the users.
I am not getting any idea how to do.
Please help me in, how to call a procedure at background and how to pass alert to all the users whoever are loggedin.

Please give me some example code also.

Regards,
Sree
 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two parts to it, the periodic background task and the user notificasion.

The periodic task can be done by a java.util.Timer and TimerTask, which is essentially a thread that runs at certain prespecified times.

The user notification can only be done indirectly, since a web app can't call the web client directly. The background task might set a flag in the user session which signals that the next time this user accesses the web app, there should be some kind of notification at the top of the page. Alternatively, the background task could send an email to the user.
 
sridhar lakka
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot,
Please could you tell in detail, with some example code.
 
Ulf Dittmer
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, we try to help people learn Java here, not provide them with solutions. So, what have you implemented so far? What specific questions do you have?

If you aren't familiar with Timer/TimerTask, read their javadocs and see if you can get them to work. The Java Almanac also has an example of their use.
 
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
There are two parts to it, the periodic background task and the user notificasion.

The periodic task can be done by a java.util.Timer and TimerTask, which is essentially a thread that runs at certain prespecified times.

The user notification can only be done indirectly, since a web app can't call the web client directly. The background task might set a flag in the user session which signals that the next time this user accesses the web app, there should be some kind of notification at the top of the page. Alternatively, the background task could send an email to the user.



That would be the way to go about it. You can alternatively use some kind of scheduler (Cron/ Weblogic scheduler etc etc whatever is available) to run code every X minutes.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!