@Override protected void beforeOffer(final T ref){
  if (tryLockSize != 0 && size == tryLockSize) {
    if (lock.tryLock()) {
      try {
        evictAll(true);
        if (batchedUpdatedListener != null) {
          batchedUpdatedListener.didBatchUpdates();
        }
      }
  finally {
        lock.unlock();
      }
    }
    return;
  }
  if (size + 1 == capacity) {
    lock.lock();
    try {
      evictAll(true);
      if (batchedUpdatedListener != null) {
        batchedUpdatedListener.didBatchUpdates();
      }
    }
  finally {
      lock.unlock();
    }
  }
}

@ Override protected void beforeOffer ( final T ref ) { if ( tryLockSize != 0 && size == tryLockSize ) { if ( lock . tryLock ( ) ) { try { evictAll ( true ) ; if ( batchedUpdatedListener != null ) { batchedUpdatedListener . didBatchUpdates ( ) ; } } finally { lock . unlock ( ) ; } } return ; } if ( size + 1 == capacity ) { lock . lock ( ) ; try { evictAll ( true ) ; if ( batchedUpdatedListener != null ) { batchedUpdatedListener . didBatchUpdates ( ) ; } } finally { lock . unlock ( ) ; } } }
extended to batch the updates to the base class for the outer class when the inner queue is half full ( trylock ( ) ) and when the inner queue is full ( lock ( ) ) .
