Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: InterruptedException in multi threading

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default InterruptedException in multi threading

    Hi !
    My doubt is on InterruptedException in java .
    I am asking my doubt based on sleep method in java.
    When we call interrupt on a thread which is in sleep state then InterruptedException is thrown.
    Below are my doubts:
    1)Imagine that we have called interrupt method on a thread named Thread1,which has come out from a sleep.
    Then will Thread1 throws InterruptedException?
    2)Imagine that we have called interrupt method on a thread named Thread2,which will go to sleep.
    That means now Thread2 is not in sleep state.
    Then will Thread2 throws Interrupted exception?


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: InterruptedException in multi threading

    What happened when you tried?

Similar Threads

  1. Replies: 2
    Last Post: January 6th, 2012, 10:50 PM
  2. Executing commands throws an InterruptedException even with waitFor()
    By LilaH in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 20th, 2011, 04:57 AM
  3. Possible threading issue
    By Kerr in forum Threads
    Replies: 3
    Last Post: March 6th, 2011, 05:24 PM
  4. Replies: 1
    Last Post: March 23rd, 2010, 03:29 AM
  5. Threading question....
    By neo_2010 in forum Threads
    Replies: 1
    Last Post: September 2nd, 2009, 03:38 AM