Setting thread priority doesn’t mean that Thread Scheduler will run thread with the highest priority. It all depends on underlaying platform and is not portable.

Moreover Thread.yield and Thread.setPriority are merely hints to the Thread Scheduler and can be ignored by it! To quote “Effective Java, 2nd” by Josh Bloch: Thread priorities are among the least portable features of the Java platform.