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

io.github.sinri.keel.verticles.KeelVerticleImplWithEventLogger Maven / Gradle / Ivy

Go to download

A website framework with VERT.X for ex-PHP-ers, exactly Ark Framework Users.

The newest version!
package io.github.sinri.keel.verticles;

import io.github.sinri.keel.logger.event.KeelEventLogger;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Promise;

import javax.annotation.Nonnull;

/**
 * @since 3.2.0
 */
abstract public class KeelVerticleImplWithEventLogger extends AbstractVerticle implements KeelVerticle {
    private @Nonnull KeelEventLogger logger;

    public KeelVerticleImplWithEventLogger() {
        super();
        this.logger = buildEventLogger();
    }

    @Nonnull
    public KeelEventLogger getLogger() {
        return logger;
    }

    abstract protected KeelEventLogger buildEventLogger();

    @Override
    public final void start(Promise startPromise) {
        this.logger = buildEventLogger();
        startAsKeelVerticle(startPromise);
    }

    /**
     * Just do one thing: build event logger.
     */
    @Override
    public final void start() {
        this.logger = buildEventLogger();
        this.startAsKeelVerticle();
    }

    protected void startAsKeelVerticle(Promise startPromise) {
        startAsKeelVerticle();
        startPromise.complete();
    }

    @Deprecated(since = "3.2.19")
    protected void startAsKeelVerticle() {
        // do nothing
    }

    /**
     * Just do nothing.
     */
    @Override
    public final void stop() {
    }

    @Override
    public final void stop(Promise stopPromise) throws Exception {
        stop();
        stopAsKeelVerticle(stopPromise);
    }

    /**
     * @since 3.2.19
     */
    protected void stopAsKeelVerticle(Promise stopPromise) {
        stopPromise.complete();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy