public Optional<List<Id>> generateIdBatch(final long batchSize){
  validateBatchSize(batchSize);
  for (int retries=0; retries < maximumAttempts; retries++) {
    try {
      Optional<List<Id>> result=generateIdsUsingRedis(roundRobinRedisPool.getNextRedis(),batchSize);
      if (result.isPresent()) {
        return result;
      }
      Thread.sleep(retries * retries);
    }
 catch (    RuntimeException|InterruptedException e) {
      logger.warn("Failed to generate ID. Underlying exception was: {}",e);
    }
  }
  logger.error("No ID generated. ID generation failed after {} retries.",maximumAttempts);
  return Optional.absent();
}

public Optional < List < Id > > generateIdBatch ( final long batchSize ) { validateBatchSize ( batchSize ) ; for ( int retries = 0 ; retries < maximumAttempts ; retries ++ ) { try { Optional < List < Id > > result = generateIdsUsingRedis ( roundRobinRedisPool . getNextRedis ( ) , batchSize ) ; if ( result . isPresent ( ) ) { return result ; } Thread . sleep ( retries * retries ) ; } catch ( RuntimeException | InterruptedException e ) { logger . warn ( "Failed to generate ID. Underlying exception was: {}" , e ) ; } } logger . error ( "No ID generated. ID generation failed after {} retries." , maximumAttempts ) ; return Optional . absent ( ) ; }
generate a batch of ids . it will try to generate a list of ids , retrying up to ` maximumattempts ` times .
