private QueueBufferFuture<R, Result> addIfAllowed(R request, QueueBufferCallback<R, Result> callback) {

            if (isOkToAdd(request)) {

                requests.add(request);

                QueueBufferFuture<R, Result> theFuture = new QueueBufferFuture<R, Result>(callback);

                futures.add(theFuture);
                onRequestAdded(request);
                return theFuture;

            } else {
                return null;
            }
        }
Adds the request to the batch if capacity allows it. Called by {@code addRequest} with a
lock on {@code this} held.

@param request
@return the future that will be signaled when the request is completed and can be used to
        retrieve the result. Can be null if the addition could not be done
aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/buffered/SendQueueBuffer.java