I don't see point of having another servlet set the flag to true. If you need
automatic control of the timed servlet, then the timed servlet can do that
itself (servlets can be implemented to handle multiple threads). Also, why have
the flag in a Singleton or in ServletContext? The flag can be a member variable
of the Servlet itself, one servlet, one flag (just remember to protect the flag
for concurrent access).

If you need manual control, then the same servlet can handle that as well. One
of the main purposes of a servlet is to handle requests. Just define a method of
the servlet to handle a request to stop or control the maintenance thread. When
you submit a request, doGet or doPost passes the request to the controller
method. Controller method sets the flag which tells the maintenance thread what
to do.

Kevin Mukhar

Randy Belknap wrote:
>
> You could put a flag in a Singleton or in ServletContext that the thread
> checks each time it runs.  If the flag is set, the thread dies.
>
> You would then have another servlet to set the flag to true.
>
> Jack Wang wrote:
> >
> > Hi,all,
> >
> > I have a timed servlet run in ISP machine in which JRUN is installed. The
> > timed servlet will run automatically every 2 hours. My servlet is developed
> > with Matt Tucker's CoolServlets.com's maintenanceThread.
> >
> > The servlet can be stoped by stopping JRUN, but JRUN is the service of ISP,
> > which is not controlled by me. Now my question is how can I stop or control
> > my timed servlet?

___________________________________________________________________________
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