341 |
|
|
342 |
|
/** |
343 |
|
* Returns message string for bounds exceptions on arrival. |
344 |
< |
* Declared out of-line from doArrive to reduce string op bulk. |
344 |
> |
* Declared out of line from doArrive to reduce string op bulk. |
345 |
|
*/ |
346 |
|
private String badArrive() { |
347 |
< |
return ("Attempted arrival of unregistered party for " + |
348 |
< |
this.toString()); |
347 |
> |
return "Attempted arrival of unregistered party for " + toString(); |
348 |
|
} |
349 |
|
|
350 |
|
/** |
372 |
|
} |
373 |
|
|
374 |
|
/** |
375 |
< |
* Returns message string for bounds exceptions on registration |
375 |
> |
* Returns message string for out of bounds exceptions on registration. |
376 |
|
*/ |
377 |
|
private String badRegister() { |
378 |
< |
return ("Attempt to register more than " + MAX_COUNT + " parties for "+ |
379 |
< |
this.toString()); |
378 |
> |
return "Attempt to register more than " + |
379 |
> |
MAX_COUNT + " parties for " + toString(); |
380 |
|
} |
381 |
|
|
382 |
|
/** |
769 |
|
} |
770 |
|
|
771 |
|
/** |
772 |
< |
* Returns a string identifying this phaser, as well as its |
773 |
< |
* state. The state, in brackets, includes the String {@code |
774 |
< |
* "phase = "} followed by the phase number, {@code "parties = "} |
775 |
< |
* followed by the number of registered parties, and {@code |
776 |
< |
* "arrived = "} followed by the number of arrived parties. |
772 |
> |
* Returns a string identifying this phaser, as well as its state. |
773 |
> |
* The state, in brackets, includes the String {@code "phase = "} |
774 |
> |
* followed by the phase number, {@code "parties = "} followed by |
775 |
> |
* the number of registered parties, and {@code "arrived = "} |
776 |
> |
* followed by the number of arrived parties. |
777 |
|
* |
778 |
|
* @return a string identifying this barrier, as well as its state |
779 |
|
*/ |
786 |
|
} |
787 |
|
|
788 |
|
/** |
789 |
< |
* Removes and signals threads from queue for phase |
789 |
> |
* Removes and signals threads from queue for phase. |
790 |
|
*/ |
791 |
|
private void releaseWaiters(int phase) { |
792 |
|
AtomicReference<QNode> head = queueFor(phase); |
829 |
|
* block. The value trades off good-citizenship vs big unnecessary |
830 |
|
* slowdowns. |
831 |
|
*/ |
832 |
< |
static final int SPINS_PER_ARRIVAL = NCPU < 2? 1 : 1 << 8; |
832 |
> |
static final int SPINS_PER_ARRIVAL = (NCPU < 2) ? 1 : 1 << 8; |
833 |
|
|
834 |
|
/** |
835 |
|
* Possibly blocks and waits for phase to advance unless aborted. |