Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads and shell script  RSS feed

 
Srivatsa Mudambi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have to write a java prog that has 2 threads. One thread for executing a script (shell etc.,) and other for timeout. Once the timeout is reached the script executed must be terminated(or killed) by the thread.
To explain it more clearly, my script collects the data from different servers for every 30 seconds and if the server/s do not respond even after the timeout (30 sec), i have to terminate the script and run it afresh.

Is there a solution to this problem? Its urgent.

Thanks in advance,
M.S.Srivatsa
 
Alexander Sales
Ranch Hand
Posts: 89
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's kinda hard. so whats your preliminary approach?
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe, using a single thread and waiting for a timeout exception should solve this issue. Obviously you need to setup a timeout value.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!