Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Fox Hu
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should probably write some sample code and see what happens.
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Reshma Shanbhag
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Dan mentioned the scheduling of thread is platform dependent so cannot be predicted.
[ March 03, 2003: Message edited by: Reshma Pai ]
 
mohamed hamdy
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Dan,
what about the stop method?
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stop method is deprecated. It is my understanding that it won't appear on the 1.4 version of the exam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic