• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Theading problem

 
Juwonlo Ibigbami
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please can anyone tell me how a sleeping and a waiting thread can be interrupted
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In class Tread there are three methods that have to do with interupts. They all have "interrupt" in their method name. Have a look in the API. A simple way to interrupt is to call method interrupt():


produces something like this, exact location of the exception message in the output will be system dependent.
main ready
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at test.€42.run(Main.java:31)
0
1
2
3
4
5
6
7
8
9
10
11
12



Yours,
Bu.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic