Kevin
I have a test of your method of simply putting
"maintenanceThread.shutDown();"
in the post method and putting a button in the html page , it does stop the
timed
thread(as a test, I let it write the counter to a file), but when I start
the servlet again,
it can not write the counter to the file. I check the system information,
it seems
to be that the maintenanceThread is again running periodically.
Maybe the problem is that I didn'd use the Singleton to save the thread
instence, but I did not run the same servlet at the same time, so it is
still a question to me.
/* Following is the code of PaintenceServlet.java
public void shutDown() {
done = true;
}
public void run() {
//While the user has not called the shutDown() method.
while (!done) {
try {
//Wait for the specified amount of time before continuing.
long timeToWait = secondsToWait*SECOND;
timeToWait += minutesToWait*MINUTE;
timeToWait += hoursToWait*HOUR;
timeToWait += daysToWait*DAY;
sleep(timeToWait);
//Tell the servlet to perform the maintenance function
if (!done) servletReference.doMaintenance();
}
catch (Exception e) {
//we'll ignore errors...
}
}
}
jack.w
___________________________________________________________________________
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