src/main/java/edu/ucla/library/bucketeer/verticles/S3BucketVerticle.java
private void shouldRetry(final String aImageID, final Handler<AsyncResult<Boolean>> aHandler) {
        final Promise<Boolean> promise = Promise.promise();

        promise.future().onComplete(aHandler);

        vertx.sharedData().getLocalCounter(aImageID, getCounter -> {
            if (getCounter.succeeded()) {
                final Counter counter = getCounter.result();

                counter.addAndGet(1L, get -> {
                    if (get.succeeded()) {
                        if (get.result() == myMaxRetries) {
                            promise.complete(Boolean.FALSE);

                            // Reset the counter in case we ever need to process this item again
                            counter.compareAndSet(myMaxRetries, 0L, reset -> {
                                if (reset.failed()) {
                                    LOGGER.error(MessageCodes.BUCKETEER_133, aImageID);
                                }
                            });
                        } else {
                            promise.complete(Boolean.TRUE);
                        }
                    } else {
                        promise.fail(get.cause());
                    }
                });
            } else {
                promise.fail(getCounter.cause());
            }
        });
    }
/**
     * A check to see whether an errored request should be retried.
     *
     * @param aImageID An image ID
     * @param aHandler A retry handler
     */
A check to see whether an errored request should be retried.
@param aImageID An image ID
@param aHandler A retry handler
A check to see whether an errored request should be retried . @param aImageID An image ID @param aHandler A retry handler
private void shouldRetry(final String aImageID, final Handler<AsyncResult<Boolean>> aHandler) {
        final Promise<Boolean> promise = Promise.promise();
        promise.future().onComplete(aHandler);
        vertx.sharedData().getLocalCounter(aImageID, getCounter -> {
            if (getCounter.succeeded()) {
                final Counter counter = getCounter.result();
                counter.addAndGet(1L, get -> {
                    if (get.succeeded()) {
                        if (get.result() == myMaxRetries) {
                            promise.complete(Boolean.FALSE);
                            counter.compareAndSet(myMaxRetries, 0L, reset -> {
                                if (reset.failed()) {
                                    LOGGER.error(MessageCodes.BUCKETEER_133, aImageID);
                                }
                            });
                        } else {
                            promise.complete(Boolean.TRUE);
                        }
                    } else {
                        promise.fail(get.cause());
                    }
                });
            } else {
                promise.fail(getCounter.cause());
            }
        });
    }
private void shouldRetry ( final String aImageID , final Handler < AsyncResult < Boolean > > aHandler ) { final Promise < Boolean > promise = Promise . promise ( ) ; promise . future ( ) . onComplete ( aHandler ) ; vertx . sharedData ( ) . getLocalCounter ( aImageID , getCounter -> { if ( getCounter . succeeded ( ) ) { final Counter counter = getCounter . result ( ) ; counter . addAndGet ( 1L , get -> { if ( get . succeeded ( ) ) { if ( get . result ( ) == myMaxRetries ) { promise . complete ( Boolean . FALSE ) ; counter . compareAndSet ( myMaxRetries , 0L , reset -> { if ( reset . failed ( ) ) { LOGGER . error ( MessageCodes . BUCKETEER_133 , aImageID ) ; } } ) ; } else { promise . complete ( Boolean . TRUE ) ; } } else { promise . fail ( get . cause ( ) ) ; } } ) ; } else { promise . fail ( getCounter . cause ( ) ) ; } } ) ; }
A check to see whether an errored request should be retried.
A check to see whether an errored request should be retried .
// Reset the counter in case we ever need to process this item again