protected Long getAndRemoveNextAvailableID() throws InterruptedException {
    Long next = null;
    acquireWriteLock();
    try {
      if (idsAvailable.isEmpty()) {
        if (waitForData()) {
          Iterator itr = idsAvailable.iterator();
          next = (Long) itr.next();
          itr.remove();
          incrementTakeSidePutPermits();
        }
      } else {
        Iterator itr = idsAvailable.iterator();
        next = (Long) itr.next();
        itr.remove();
        incrementTakeSidePutPermits();
      }
    } finally {
      releaseWriteLock();
    }
    return next;
  }
This method is invoked by the take function . For non blocking queue it returns null or a valid
long position while for blocking queue it waits for data in the queue or throws Exception if
the thread encounters exception while waiting.
geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java