aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes setPriority method on a thread object directly cause a thread to stop executing ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "setPriority method on a thread object directly cause a thread to stop executing ?" Watch "setPriority method on a thread object directly cause a thread to stop executing ?" New topic
Author

setPriority method on a thread object directly cause a thread to stop executing ?

Fox Hu
Ranch Hand

Joined: Jan 23, 2003
Posts: 49
Calling the setPriority method on a thread object directly cause a thread to stop executing ?
And in which other occasion can directly cause a thread to stop executing ?
Besides wait(), yield(), sleep() .
Rodney Woodruff
Ranch Hand

Joined: Dec 04, 2001
Posts: 80
You should probably write some sample code and see what happens.


Hope This Helps
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
The behavior of the thread scheduler is platform dependent. On some platforms the thread scheduler might make use of the priority level but on others the priority level might be ignored. Since there is no guarantee that the thread scheduler even makes use of the priority level there can be no guarantee that changing the priority level will have an effect.
For the purposes of the exam, a statement is true only if the statement is guaranteed by the Java Language Specification or the API Specification (javadocs). Since there is no guarantee that the thread scheduler will react to a change in thread priority, any claim that such an action can cause a thread to stop must be a false statement for the purposes of the exam.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Reshma Shanbhag
Ranch Hand

Joined: Sep 17, 2002
Posts: 203
As Dan mentioned the scheduling of thread is platform dependent so cannot be predicted.
[ March 03, 2003: Message edited by: Reshma Pai ]

SCJP 1.4, SCWCD 1.4
mohamed hamdy
Ranch Hand

Joined: Feb 13, 2003
Posts: 72
hi Dan,
what about the stop method?
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
The stop method is deprecated. It is my understanding that it won't appear on the 1.4 version of the exam.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setPriority method on a thread object directly cause a thread to stop executing ?