Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Theading problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Theading problem" Watch "Theading problem" New topic
Author

Theading problem

Juwonlo Ibigbami
Ranch Hand

Joined: Nov 03, 2006
Posts: 83
Please can anyone tell me how a sleeping and a waiting thread can be interrupted
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
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.


all events occur in real time
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Theading problem
 
Similar Threads
Can the color for the disabled item be changed
WA #1.....word association
Private methods
URGENT - NEED HELP - Block Code
error in Marcus Green 2.