public static V waitForFuture()

in src/main/java/com/amazonaws/services/sqs/util/SQSQueueUtils.java [214:237]


    public static <V> V waitForFuture(Future<V> future) {
        V toReturn = null;
        try {
            toReturn = future.get();
        } catch (InterruptedException ie) {
            Thread.currentThread().interrupt();
            throw new AmazonClientException(
                    "Thread interrupted while waiting for execution result", ie);
        } catch (ExecutionException ee) {
            // if the cause of the execution exception is an SQS exception, extract it
            // and throw the extracted exception to the clients
            // otherwise, wrap ee in an SQS exception and throw that.
            Throwable cause = ee.getCause();

            if (cause instanceof AmazonClientException) {
                throw (AmazonClientException) cause;
            }

            throw new AmazonClientException(
                    "Caught an exception while waiting for request to complete...", ee);
        }

        return toReturn;
    }