code: public long claim(long toClaimMb) throws RejectRequestException {
      Preconditions.checkArgument(toClaimMb >= 0);
      if (toClaimMb == 0) {
        return 0;
      }
      int neededForRequest = capRequestedSize(toClaimMb);
      boolean acquired = false;
      try {
        acquired = amountRemaining.tryAcquire(neededForRequest, TIME_TO_WAIT, TimeUnit.MILLISECONDS);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new RejectRequestException("Was interupted", e);
      }
      int remaining = amountRemaining.availablePermits();
      if (acquired) {
        log.info("Target available memory was " + (neededForRequest + remaining) + "mb is now "
            + remaining + "mb");
        return neededForRequest;
      } else {
        throw new RejectRequestException("Not enough estimated memory for request: "
            + (neededForRequest) + "mb only have " + remaining + "mb remaining out of "
            + TOTAL_CLAIMABLE_MEMORY_SIZE_MB + "mb");
      }
    }
docs: This method attempts to claim ram to the provided request. This may block waiting for some to
  be available. Ultimately it is either granted memory or an exception is thrown.
  
  @param toClaimMb The amount of memory the request wishes to claim. (In Megabytes)
  @return The amount of memory which was claimed. (This may be different from the amount
  requested.) This value needs to be passed to {@link #release} when the request exits.
  
  @throws RejectRequestException If the request should be rejected because it could not be given
  the resources requested.