/** * Sets the priority of this thread. If the requested priority is greater than the parent thread * group's {@link java.lang.ThreadGroup#getMaxPriority}, the group's maximum priority will be used * instead. * * @throws IllegalArgumentException - if the new priority is greater than {@link #MAX_PRIORITY} or * less than {@link #MIN_PRIORITY} */ public final void setPriority(int priority) { if (priority < Thread.MIN_PRIORITY || priority > Thread.MAX_PRIORITY) { throw new IllegalArgumentException("Priority out of range: " + priority); } if (priority > group.getMaxPriority()) { priority = group.getMaxPriority(); } this.priority = priority; VMThread vmt = this.vmThread; if (vmt != null) { vmt.setPriority(priority); } }