Class AbstractVerticle

  • All Implemented Interfaces:
    io.vertx.core.Verticle

    public class AbstractVerticle
    extends io.vertx.core.AbstractVerticle
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Vertx vertx  
      • Fields inherited from class io.vertx.core.AbstractVerticle

        context
    • Field Detail

      • vertx

        protected Vertx vertx
    • Constructor Detail

      • AbstractVerticle

        public AbstractVerticle()
    • Method Detail

      • init

        public void init​(io.vertx.core.Vertx vertx,
                         io.vertx.core.Context context)
        Initialise the verticle. This is called by Vert.x when the verticle instance is deployed. Don't call it yourself.
        Specified by:
        init in interface io.vertx.core.Verticle
        Overrides:
        init in class io.vertx.core.AbstractVerticle
        Parameters:
        vertx - the deploying Vert.x instance
        context - the context of the verticle
      • start

        public void start​(io.vertx.core.Promise<Void> startPromise)
                   throws Exception
        Start the verticle. This is called by Vert.x when the verticle instance is deployed. Don't call it yourself.

        If your verticle does things in its startup which take some time then you can override this method and call the startPromise some time later when start up is complete. NOTE: Using asyncStart() is recommended.

        Specified by:
        start in interface io.vertx.core.Verticle
        Overrides:
        start in class io.vertx.core.AbstractVerticle
        Parameters:
        startPromise - a promise which should be called when verticle start-up is complete.
        Throws:
        Exception
      • stop

        public void stop​(io.vertx.core.Promise<Void> stopPromise)
                  throws Exception
        Stop the verticle.

        This is called by Vert.x when the verticle instance is un-deployed. Don't call it yourself. If your verticle does things in its shut-down which take some time then you can override this method and call the stopPromise some time later when clean-up is complete. NOTE: Using asyncStop() is recommended.

        Specified by:
        stop in interface io.vertx.core.Verticle
        Overrides:
        stop in class io.vertx.core.AbstractVerticle
        Parameters:
        stopPromise - a promise which should be called when verticle clean-up is complete.
        Throws:
        Exception
      • asyncStart

        public io.smallrye.mutiny.Uni<Void> asyncStart()
        Start the verticle. This is called by Vert.x when the verticle instance is deployed. Don't call it yourself.

        If your verticle does things in its startup which take some time then you can override this method and returns a Uni completed with the start up is complete. Propagating a failure fails the deployment of the verticle

        Returns:
        a Uni completed when the start up completes, or failed if the verticle cannot be started.
      • asyncStop

        public io.smallrye.mutiny.Uni<Void> asyncStop()
        Stop the verticle.

        This is called by Vert.x when the verticle instance is un-deployed. Don't call it yourself. If your verticle does things in its shut-down which take some time then you can override this method and returns an Uni completed when the clean-up is complete.

        Returns:
        a Uni completed when the clean-up completes, or failed if the verticle cannot be stopped gracefully.