• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question on process timing out - how to handle?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope this is the right topic for this.

Quick scenario. I have a class method that runs bat files. In the bat file, is a call to the java compiler. If the bat file runs successfully it indicates success and dumps the screen response into a StringBuffer.

If it fails, it indicates that it failed and does the same thing.

I can get it to run successfully, so I know the success message works just fine. When I intentionally tried to break it (ie., changed the name of the file to be compiled to something that is nonexistant) to test the failure message, instead of returning a failure message, it hung - I even let it run all night (had to go to bed anyway).

Is there a way to poll to see if the process is hung and then cancel it?

Thanks in advance.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you reading the stdout and errout streams from the process you started? Some processes will hang if you are not reading the streams. Search the IO & streams forum for "StreamGobbler" for some other discussions on this.
 
reply
    Bookmark Topic Watch Topic
  • New Topic