All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.up.uca.job.center.PlanAgha Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.up.uca.job.center;

import io.vertx.core.Future;
import io.vertx.up.atom.worker.Mission;
import io.vertx.up.eon.em.JobStatus;

class PlanAgha extends AbstractAgha {

    @Override
    public Future begin(final Mission mission) {
        final Future future = Future.future();
        /*
         * Preparing for job
         **/
        preparing(mission);

        interval().startAt(mission.getDuration(), (timeId) -> {
            if (JobStatus.READY == mission.getStatus()) {
                /*
                 * Running the job
                 */
                working(mission).compose(envelop -> {
                    /*
                     * Complete future and returned Async
                     */
                    future.complete(timeId);
                    return Future.succeededFuture(envelop);
                });
            }
        });
        return future;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy