public synchronized QueueBufferFuture<R, Result> addRequest(R request, QueueBufferCallback<R, Result> callback) {

            if (closed) {
                return null;
            }

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

            // if the addition did not work, or this addition made us full,
            // we can close the request.
            if ((null == theFuture) || isFull()) {
                closed = true;
                notify();
            }

            return theFuture;
        }
Adds a request to the batch if it is still open and has capacity.

@return the future that can be used to get the results of the execution, or null if the
        addition failed.
aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/buffered/SendQueueBuffer.java