Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Exclamation Need some help in thread programming

    Please help me on this. I need to do the following:

    1) I need to execute a shell script through java program and write the output of the script to the file

    2) If the execution of the shell script takes more than 10 mins, I should kill the process. This monitoring should be done in a separate thread.

    3) Also I need to monitor the CPU/Memory of the process fives times with an interval of 10 mins, If the cpu of the process is high (>70) all the times then I need to kill the process. This should be done in a separate thread.

    As am new to threading , could someone help me on this coding ?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    What do you mean "help me with this coding" since that's not really an answerable question? Surely you don't mean for us to either write the code for you or re-write threading tutorials that have already been written? If you have any specific questions, we'll be glad to help. Please read the 2nd link in my signature links, on how to ask smart questions.

    Much luck!

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Read this thoroughly. It will ensure that you avoid the majority of the problems you would normally run into, and if your somewhat clever you'll pick up the clues from it needed to implement your timeout.

Similar Threads

  1. Difference between Thread.yield() and Thread.sleep() methods
    By Nageswara Rao Mothukuri in forum New To Java
    Replies: 12
    Last Post: 07-30-2010, 06:37 PM
  2. Trigger main thread method from secondary thread?
    By DigitalMan in forum Threads and Synchronization
    Replies: 8
    Last Post: 01-26-2010, 03:13 AM
  3. The Fav. Programming Quotes Thread
    By angryboy in forum Forum Lobby
    Replies: 3
    Last Post: 06-13-2009, 11:16 AM
  4. Replies: 0
    Last Post: 01-28-2008, 08:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •