If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Monitoring a particular Table as soon as my Webserver(Application Server) is up.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-05-03, 22:54
csanand csanand is offline
Registered User
 
Join Date: Sep 2003
Location: India
Posts: 1
Monitoring a particular Table as soon as my Webserver(Application Server) is up.

Hello friends,
Problem definition = I want to monitor a particular "table" in a database (MSSQLServer 2k or DB2 or Oracle8i) as soon as my Application Server(Weblogic 6.1 or Websphere ) is started.
The reason for monitoring is that, if some rows satisfy a particular condition then those rows have to be e-mailed to the concerned party.
I tried two possibilities
1)putting a <load-on-startup> tag, in my web.xml, and including my servlet's name which will perform the monitoring (the servlet instantiates an object of a class which extends Thread, and then calls the run() method).
NOTE:-- The run() method is in a while(true) loop, b'coz of continuous monitoring till the Appserver is closed.
2)Implented the "ServletContextListener " Interface and overridded the methods "contextInitialized(ServletContexEvent sce)" and "contextDestroyed(ServletContexEvent sce)".
The problem is that both the above methods serve the purpose of starting up the servlet and start the run() method of the Thread, but the Webserver(in my case Weblogic 6.1) does not entertain any other requests (for eg :-- not showing the Welcome Page) .
I think so the Webserver does not start properly and just in b/w of it's startup directly goes to execute the "startup servlet".
If I comment the line of "<load-on-startup>servletname</load-on-startup>" then the Webserver (Weblogic 6.1) starts up properly and entertains all requests.

Please suggest me any solution, by which I could achieve my task of monitoring that table as soon as AppServer get's started.

I am attaching three files, all combined into "Daemon.zip"
1)The servlet file which is called at "<load-on-startup>" or "implements ServletContextListener"
2)The class which extends Thread
3)Web.xml
Attached Files
File Type: zip daemon.zip (1.5 KB, 8 views)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On