Re: Persistence of process thread despite re-loading browser

Adrian Janssen <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
Sounds like the JSP page is being cached somewhere (browser, proxty etc),
which will prevent the code from running on the second request. Set the
following headers to prevent this:

             response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
             response.setHeader("Pragma","no-cache"); //HTTP 1.0
             response.setDateHeader ("Expires", 0); //prevents caching at
the proxy server

Cheers
Adrian



> -----Original Message-----
> From: Sam Seaver [SMTP:[email protected]]
> Sent: 14 April 2003 06:38
> To:   [email protected]
> Subject:      Persistence of process thread despite re-loading browser
>
> Dear all,
>
> I have this code in a bean:
>
>
> public void doMonster(){
>         String[] cmd ={"/home/seaver/MONSTER/monster", "-i" + jobID,
> filePath + dir
> + pdbFileName};
>
>
>         try{
>             Process proc = Runtime.getRuntime().exec(cmd);
>             BufferedWriter output = new BufferedWriter(new
> OutputStreamWriter(proc.getOutputStream()));
>             BufferedReader input = new BufferedReader(new
> InputStreamReader(proc.getInputStream()));
>             BufferedReader error = new BufferedReader(new
> InputStreamReader(proc.getErrorStream()));
>
>
>             output.close();
>             input.close();
>             error.close();
>         }catch (Throwable t){
>             t.printStackTrace();
>         }
>     }
>
> I have a JSP page that simply runs doMonster, the bean's parameters are
> already in the bean, and the first time, monster runs very well.
>
> However, if I keep the browser window open, and even if I restart Tomcat,
> when I try to run monster from the JSP page again, it does not run!  The
> JSP
> page creates the directory for the output files, but still, monster itself
> actually doesn't execute.
>
> I've been browsing through the web, and I've read somewhere that if a
> servlet starts an external thread, then that thread itself will persist
> even
> if the servlet is reloaded.  Is this true?
>
> If is I can see that I need to actually find this thread and kill it.  For
> even if monster itself has finished running, the process wont run again.
> It
> takes a few restarts of tomcat and reloading of the browser before i can
> get
> monster to run again, and I'm sure it's something to do with thread
> persistence.
>
> Does anyone have any insight?
> Thanks
> Sam
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
> __________________________________________________________________________
> _
> 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
--

It is the strict policy of Truworths that its e-mail facility and all
e-mail communications emanating therefrom, should be utilised for
business purposes only and should conform to high professional and
business standards.   Truworths has stipulated certain regulations in
terms whereof strict guidelines relating to the use and content of
e-mail communications are laid down. The use of the Truworths e-mail
facility is not permitted for the distribution of chain letters or
offensive mail of any nature whatsoever.   Truworths hereby distances
itself from and accepts no liability in respect of the unauthorised
use of its e-mail facility or the sending of e-mail communications
for other than strictly business purposes.   Truworths furthermore
disclaims liability for any  unauthorised instruction for  which
permission was not granted.    Truworths Limited accepts no liability
for any consequences arising from or as a result of reliance on this
message unless it is in respect of bona fide Truworths business for
which proper authorisation has been granted.

Any recipient of an unacceptable communication, a chain letter or
offensive material of any nature is requested to notify the Truworths
e-mail administrator ([email protected]) immediately in order that
appropriate action can be taken against the individual concerned.

___________________________________________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.