Persistence of process thread despite re-loading browser
Sam Seaver <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
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