src/main/java/edu/ucla/library/bucketeer/verticles/FinalizeJobVerticle.java
private void removeJob(final String aJobName, final Handler<AsyncResult<Job>> aHandler) {
        final Promise<Job> promise = Promise.<Job>promise();

        promise.future().onComplete(aHandler);

        vertx.sharedData().<String, Job>getLocalAsyncMap(Constants.LAMBDA_JOBS, getMap -> {
            if (getMap.succeeded()) {
                final AsyncMap<String, Job> map = getMap.result();

                map.keys(keyCheck -> {
                    if (keyCheck.succeeded()) {
                        final Set<String> jobs = keyCheck.result();

                        if (jobs.contains(aJobName)) {
                            map.get(aJobName, getJob -> {
                                if (getJob.succeeded()) {
                                    map.remove(aJobName, removeJob -> {
                                        if (removeJob.succeeded()) {
                                            promise.complete(removeJob.result());
                                        } else {
                                            failPromise(getMap.cause(), MessageCodes.BUCKETEER_082, aJobName, promise);
                                        }
                                    });
                                } else {
                                    failPromise(getJob.cause(), MessageCodes.BUCKETEER_076, aJobName, promise);
                                }
                            });
                        } else {
                            failPromise(new JobNotFoundException(MessageCodes.BUCKETEER_075, aJobName),
                                    MessageCodes.BUCKETEER_075, aJobName, promise);
                        }
                    } else {
                        failPromise(keyCheck.cause(), MessageCodes.BUCKETEER_062, aJobName, promise);
                    }
                });
            } else {
                failPromise(getMap.cause(), MessageCodes.BUCKETEER_063, Constants.LAMBDA_JOBS, promise);
            }
        });
    }
/**
     * The dirty work of actually getting the job from the shared data cache.
     *
     * @param aJobName The name of a job we want to retrieve
     * @param aPromise A promise for the work being done
     * @param aHandler A handler to handle the result of the promise
     */
The dirty work of actually getting the job from the shared data cache.
@param aJobName The name of a job we want to retrieve
@param aPromise A promise for the work being done
@param aHandler A handler to handle the result of the promise
The dirty work of actually getting the job from the shared data cache . @param aJobName The name of a job we want to retrieve @param aPromise A promise for the work being done @param aHandler A handler to handle the result of the promise
private void removeJob(final String aJobName, final Handler<AsyncResult<Job>> aHandler) {
        final Promise<Job> promise = Promise.<Job>promise();
        promise.future().onComplete(aHandler);
        vertx.sharedData().<String, Job>getLocalAsyncMap(Constants.LAMBDA_JOBS, getMap -> {
            if (getMap.succeeded()) {
                final AsyncMap<String, Job> map = getMap.result();
                map.keys(keyCheck -> {
                    if (keyCheck.succeeded()) {
                        final Set<String> jobs = keyCheck.result();
                        if (jobs.contains(aJobName)) {
                            map.get(aJobName, getJob -> {
                                if (getJob.succeeded()) {
                                    map.remove(aJobName, removeJob -> {
                                        if (removeJob.succeeded()) {
                                            promise.complete(removeJob.result());
                                        } else {
                                            failPromise(getMap.cause(), MessageCodes.BUCKETEER_082, aJobName, promise);
                                        }
                                    });
                                } else {
                                    failPromise(getJob.cause(), MessageCodes.BUCKETEER_076, aJobName, promise);
                                }
                            });
                        } else {
                            failPromise(new JobNotFoundException(MessageCodes.BUCKETEER_075, aJobName),
                                    MessageCodes.BUCKETEER_075, aJobName, promise);
                        }
                    } else {
                        failPromise(keyCheck.cause(), MessageCodes.BUCKETEER_062, aJobName, promise);
                    }
                });
            } else {
                failPromise(getMap.cause(), MessageCodes.BUCKETEER_063, Constants.LAMBDA_JOBS, promise);
            }
        });
    }
private void removeJob ( final String aJobName , final Handler < AsyncResult < Job > > aHandler ) { final Promise < Job > promise = Promise . < Job > promise ( ) ; promise . future ( ) . onComplete ( aHandler ) ; vertx . sharedData ( ) . < String , Job > getLocalAsyncMap ( Constants . LAMBDA_JOBS , getMap -> { if ( getMap . succeeded ( ) ) { final AsyncMap < String , Job > map = getMap . result ( ) ; map . keys ( keyCheck -> { if ( keyCheck . succeeded ( ) ) { final Set < String > jobs = keyCheck . result ( ) ; if ( jobs . contains ( aJobName ) ) { map . get ( aJobName , getJob -> { if ( getJob . succeeded ( ) ) { map . remove ( aJobName , removeJob -> { if ( removeJob . succeeded ( ) ) { promise . complete ( removeJob . result ( ) ) ; } else { failPromise ( getMap . cause ( ) , MessageCodes . BUCKETEER_082 , aJobName , promise ) ; } } ) ; } else { failPromise ( getJob . cause ( ) , MessageCodes . BUCKETEER_076 , aJobName , promise ) ; } } ) ; } else { failPromise ( new JobNotFoundException ( MessageCodes . BUCKETEER_075 , aJobName ) , MessageCodes . BUCKETEER_075 , aJobName , promise ) ; } } else { failPromise ( keyCheck . cause ( ) , MessageCodes . BUCKETEER_062 , aJobName , promise ) ; } } ) ; } else { failPromise ( getMap . cause ( ) , MessageCodes . BUCKETEER_063 , Constants . LAMBDA_JOBS , promise ) ; } } ) ; }
The dirty work of actually getting the job from the shared data cache.
The dirty work of actually getting the job from the shared data cache .