Take the 2-minute tour ×

I'm reading part 17.2.1 of Java language specification: http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.2.1

I won't copy a text, it's too long, but I would like to know, why for third step of sequence they're saying that

If thread t was removed from m's wait set in step 2 due to an interrupt

Thread couldn't get to step 2 it wasn't removed from wait set, because it written for the step 1:

Thread t does not execute any further instructions until it has been removed from m's wait set

Thus thread can't be removed from wait set in step 2 whatever it's due to, because it was already removed.

Please help me understand this.

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

This is a bug caused by mistake in updating from prior version JLS, Third Edition 17.8.1 Wait, missing number of the list item.

Prior version JLS had the respective sequence listed from 1 to 4, not from 1 to 3:

  1. Thread t is added to the wait set...
  2. Thread t does not execute any further instructions until...
  3. Thread t performs n lock actions....
  4. If thread t was removed from m's wait set in step 2...

As you may see, step 2 in original version document refers to the part other than currently marked 2.

Compared to original version, JLS Java SE 7 Edition 17.2.1. Wait has lost list number (likely lost <li class="listitem"> in html) at the item Thread t does not execute...

As a result, whole sequence now lists from 1 to 3 and words "step 2" left unchanged from original version refer reader to wrong item that has been previously marked 3, not 2.


share|improve this answer
add comment

That is probably just a typo and is meant to be step 1.

Typos happen even in large projects and where a lot of people work on it.

share|improve this answer
I believe it's the only reason, because logically no way what is written can be true. –  dhblah Nov 27 '12 at 20:51
ping this to the concurrency-interest group that Doug Lea runs, you'll get confirmation there. –  Martijn Verburg Nov 27 '12 at 21:43
I asked about it on the concurrency interest mailing list and they replied that hard copy of JLS contains additional numbered point on "Thread t does not execute any further instructions". So step 2 that is referred to on step 3 (which is actually a step 4) is that step with a missing numbered point. So it's just a missed numbered point that caused a confusion. –  dhblah Nov 28 '12 at 10:06
add comment

Your Answer


