You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sam Seaver <sa...@hotmail.com> on 2003/04/17 02:51:22 UTC

Re: Persistence of process thread despite re-loading browser


"JC Rules"




>From: Adrian Janssen <aj...@TRUWORTHS.CO.ZA>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java       
>         Servlet API Technology." <SE...@JAVA.SUN.COM>
>To: SERVLET-INTEREST@JAVA.SUN.COM
>Subject: Re: Persistence of process thread despite re-loading browser
>Date: Tue, 15 Apr 2003 09:06:33 +0200
>Received: from mc10-f30.bay6.hotmail.com ([65.54.166.166]) by 
>mc10-s16.bay6.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Tue, 15 
>Apr 2003 00:13:28 -0700
>Received: from swjscmail2.java.sun.com ([192.18.99.108]) by 
>mc10-f30.bay6.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Tue, 15 
>Apr 2003 00:12:32 -0700
>Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by 
>swjscmail2.java.sun.com (Postfix) with ESMTPid E9F6C21D67; Tue, 15 Apr 2003 
>01:08:30 -0600 (MDT)
>Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8d) 
>with          spool id 6540456 for SERVLET-INTEREST@JAVA.SUN.COM; Tue, 15 
>Apr 2003          01:05:46 -0600
>Received: from mfwc002.CTNMFW.IS.CO.ZA (mfwc002.mfw.is.co.za 
>[196.36.153.80])          by swjscmail1.java.sun.com (Postfix) with ESMTP 
>id BF26048E1 for          <SE...@java.sun.com>; Tue, 15 Apr 2003 
>01:05:43 -0600 (MDT)
>Received: from saturn.truworths.co.za (not verified[196.36.178.228]) by     
>      mfwc002.CTNMFW.IS.CO.ZA with MailMarshal (4,2,5,0) id <BB005a4f86>;   
>        Tue, 15 Apr 2003 09:12:02 +0200
>Received: (from nobody@localhost) by saturn.truworths.co.za (8.12.3/8.12.3) 
>id          h3F7C1Ql023846 for <SE...@JAVA.SUN.COM>; Tue, 15 Apr 
>2003          09:12:01 +0200 (SAST) (envelope-from 
>ajanssen@truworths.co.za)
>Received: by saturn.truworths.co.za via recvmail id 23715; Tue, 15 Apr 2003 
>          09:11:25 +0200 (SAST)
>X-Message-Info: 29Fz9OI/FlghUpOyUsUK2Al/ygAY+JW2
>Delivered-To: servlet-interest@java.sun.com
>X-Mailer: Internet Mail Service (5.5.2650.21)
>Message-ID:  <11...@truworths.co.za>
>Sender: "A mailing list for discussion about Sun Microsystem's Java         
>       Servlet API Technology." <SE...@JAVA.SUN.COM>
>Return-Path: owner-servlet-interest@JAVA.SUN.COM
>X-OriginalArrivalTime: 15 Apr 2003 07:12:33.0829 (UTC) 
>FILETIME=[62D14550:01C3031E]
>
>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:samseaver@HOTMAIL.COM]
> > Sent: 14 April 2003 06:38
> > To:   SERVLET-INTEREST@JAVA.SUN.COM
> > 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 listserv@java.sun.com 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 (abuse@truworths.co.za) immediately in order that
>appropriate action can be taken against the individual concerned.
>
>___________________________________________________________________________
>To unsubscribe, send email to listserv@java.sun.com 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
>


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org