File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes question regarding java thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "question regarding java thread" Watch "question regarding java thread" New topic

question regarding java thread

Chandan Ghosh

Joined: Jun 13, 2005
Posts: 21
I have one doubt of a question as follows...

Q Does the calling of setPriority() method cause a thread to stop executing??

Thanks & Regards,<br />Chandan Ghosh<br />SCJP1.4
Andre Dings

Joined: Aug 08, 2007
Posts: 1

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.


... excuse my horrendous english ...
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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

Joined: Aug 08, 2007
Posts: 202
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.

Brazil - Sun Certified Java Programmer - SCJP 5 About Java - Update every Week.
Guide SCJP - tips that you need know
I agree. Here's the link:
subject: question regarding java thread
jQuery in Action, 3rd edition