Hello All,
In our application we are loading config files(*.txt files) at Init method, and it 
will be stored in ServletContext. Thing is any time config file(s) values may change, 
so a demon process should update the latest config file(s) into ServletContext, till 
now we are restarting the servlet runner to update the latest
files.
Actually, i want to update the files without restarting the ServletRunner. For pilot 
test i wrote a Java application in that i used "Timer" class, which use check the 
files status continuously for the given time DELAY. This works very fine as a just 
Java application..

import java.io.*;
import javax.swing.*;

public class Test
{
public static int chk = 0;

public static void main( String [] args)
{
 DummyAction lDummyAction = new DummyAction();

 Timer startTimer = new Timer(10000, lDummyAction);
 startTimer.setDelay(10000);
 startTimer.setRepeats(true);
 startTimer.start();

 while(true); // keep live the main Thread
}

} // end of test class

class DummyAction implements java.awt.event.ActionListener
{
 public DummyAction(String dirName)
 { System.out.println("Object Created : "); }

 public synchronized void actionPerformed(java.awt.event.ActionEvent event)
 {
    // Chk file current time and the registered previous time and upload the changed 
files
   // ACTUAL IMPLEMENTATION.....
 }
}// end of DummyAction (inner class)
} // end of Test class (outer calss)

Question ???
-------------
but when i implement this in my Servlet it's not at coming after this 
"startTimer.start();" statement.
1. I added the following code, in Init method, class DummyAction is the Inner class of 
my Servlet
2. How can write this as a demon process.

 Timer startTimer = new Timer(10000, lDummyAction);
 startTimer.setDelay(10000);
 startTimer.setRepeats(true);
 startTimer.start();
Can some one suggest me the suitable place to implement this logic.

Regards
G S Sundaram

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to