/** * Returns a string identifying this synchronizer, as well as its state. The * state, in brackets, includes the String {@code "State ="} followed by the * current value of {@link #getState}, and either {@code "nonempty"} or * {@code "empty"} depending on whether the queue is empty. * * @return a string identifying this synchronizer, as well as its state */ public String toString() { int s = getState(); String q = hasQueuedThreads() ? "non" : ""; return super.toString() + "[State = " + s + ", " + q + "empty queue]"; }