Ejemplo n.º 1
0
 private void checkForFinale() {
   if ($gate.isPermanentlyEmpty()) {
     // give our listener a chance to notice our final drain.
     // set our listener to null at the same time.  this prevents possibly awkward loops if one
     // tries to readAllNow() in a listener before checking isExhausted().
     Listener<ReadHead<$T>> $del = $el;
     $el =
         null; /* we can't do this set after invoking the listener because it could potentially cause the whole loop we're trying to block here. */
     invokeListener($del);
   }
 }
Ejemplo n.º 2
0
 /**
  * The minimal amount of work immediately available (see the documentation of {@link #$gate} for
  * more details).
  *
  * @return the minimal amount of work immediately available.
  */
 public int size() {
   return $gate.availablePermits();
 }