• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Trapping for a block in Process.waitFor()

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm calling an executable within a Java agent thusly:

The problem is that the main program will block on the waitFor() method. I'd like to run the Process in a separate Thread and then run a timer on the main thread and interrupt the Process if the timer expires before the Process terminates.
Since Process neither extends Thread nor implements Runnable, I cannot attach it directly to a separate Thread. And since it is Abstract, I'm unable to instantiate a subclass that could otherwise be attached to a Thread.
Does anyone have a suggestion to help me trap for a hung Process and terminate it so that the main agent does not also hang?
Thanks for your help.
 
Scott Appleton
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I forgot to mention that the target of the exec is itself a java application. The main agent is being run in Lotus Notes. However, the current version of Notes (R5) uses the 1.1.8 compiler, and the requirements for this agent require that data be transmitted to an HTTPS server. JSSE supports SSL security, but is not compatible with the 1.1.8 compiler; therefore, I'm having to use a workaround wherein the data transmission is handled via an application compiled with the workstation's JDK 1.3, which must then be called from within the Notes Java agent via the Runtime.exec() method.
I'm not sure if that background is important in resolving the problem, but on the chance that it is...
 
reply
    Bookmark Topic Watch Topic
  • New Topic