private void awaitOperationsAvailable() throws InterruptedException {
  flushLock.lock();
  try {
    do {
      if (writeCache.sizex() <= cacheMaxSize || cacheMaxSize == 0) {
        if (cacheFlushFreq > 0)         canFlush.await(cacheFlushFreq,TimeUnit.MILLISECONDS);
 else         canFlush.await();
      }
    }
 while (writeCache.sizex() == 0 && !stopping.get());
  }
  finally {
    flushLock.unlock();
  }
}

private void awaitOperationsAvailable ( ) throws InterruptedException { flushLock . lock ( ) ; try { do { if ( writeCache . sizex ( ) <= cacheMaxSize || cacheMaxSize == 0 ) { if ( cacheFlushFreq > 0 ) canFlush . await ( cacheFlushFreq , TimeUnit . MILLISECONDS ) ; else canFlush . await ( ) ; } } while ( writeCache . sizex ( ) == 0 && ! stopping . get ( ) ) ; } finally { flushLock . unlock ( ) ; } }
this method awaits until enough elements in map are available or given timeout is over .
