• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question regarding java thread

 
Chandan Ghosh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one doubt of a question as follows...

Q Does the calling of setPriority() method cause a thread to stop executing??
 
Andre Dings
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

as you can see at Java 5 API Doc the method only sets a new priority in the thread group. That won't invoke a thread termination! I've never tested if it works, but as I understand this the thread will run with lower prio, so that other threads get more CPU time.

greets
Andr�
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's generally recommended not to change thread priorities, as it is platform-dependent how threads with different priorities are handled.
 
camilo lopes
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not, it only configures the priopridade of one thread. The value passing must be enters 1 to the 10. However some JVM not to implement of 1 to the 10 and yes of 1 to the 5. But if voc� to pass 10 jvm goes to adopt 5 as the maximum priority, you nao can pass a value is of this interval, therefore in execution time an exception occurs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic