posted 15 years ago
Well, strictly speaking, there are no guarantees about the effect of setPriority() on a thread. It is theoretically possible that threadTwo could start method2() before threadOne starts method1(). If this were to happen, of course method1() could not start until method2() had fully completed, and once method1 entered the wait there would be no method2() to send the notify(), so threadOne would wait forever. But in practice, I'd bet large amounts of money that no JVM implementation from any respectable vendor would ever allow threadTwo to run ahead of threadOne, given the utter difference in their priorities and the fact that threadOne.start() is called before threadTwo. It's not strictly guaranteed by the JLS, but it's pretty much guaranteed by common sense about how to implement thread priorities. IMO anyway.