getPriority method:
You could obtain the current priority setting through calling the getPriority ( ) method of Thread, displays here:
final int getPriority ( )
Implementations of Java might have radically different behavior whenever it comes to scheduling. The OS Windows 95/98/NT version works, more or less, as you would expect. Therefore other versions might work quite differently. Most of the inconsistencies arias whenever you have threads that are relying on preemptive behavior, alternative of cooperatively providing up CPU time. A safest way to get predictable, cross platform behavior along with Java is to use threads in which voluntarily provide up control of the CPU.
The following instance demonstrates two threads at various priorities that do not run on a preemptive platform in the similar way as they run on a nonpreemptive platform. One thread is set two levels above the normal priority, as defined through Thread. The NORM_PRIORITY and the other are set to two levels that are display below. The threads are begin and permitted to run for ten seconds. Every thread executes a loop, counting the number of interruptions. After ten seconds, the main thread stops both threads. A number of times in which each thread made it by the loop are then shown.