Package io.vertx.core

Class AbstractVerticle

    • Field Detail

      • vertx

        protected Vertx vertx
        Reference to the Vert.x instance that deployed this verticle
      • context

        protected Context context
        Reference to the context of the verticle
    • Constructor Detail

      • AbstractVerticle

        public AbstractVerticle()
    • Method Detail

      • getVertx

        public Vertx getVertx()
        Get the Vert.x instance
        Specified by:
        getVertx in interface Verticle
        Returns:
        the Vert.x instance
      • init

        public void init​(Vertx vertx,
                         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 Verticle
        Parameters:
        vertx - the deploying Vert.x instance
        context - the context of the verticle
      • deploymentID

        public String deploymentID()
        Get the deployment ID of the verticle deployment
        Returns:
        the deployment ID
      • config

        public JsonObject config()
        Get the configuration of the verticle.

        This can be specified when the verticle is deployed.

        Returns:
        the configuration
      • processArgs

        @Deprecated
        public List<String> processArgs()
        Deprecated.
        As of version 5, Vert.x is no longer tightly coupled to the CLI
        Returns:
        an empty list
      • deploy

        public final Future<?> deploy​(Context context)
        Description copied from interface: Deployable
        Start the deployable.

        Vert.x calls this method when deploying this deployable. You do not call it yourself.

        Specified by:
        deploy in interface Deployable
        Parameters:
        context - the Vert.x context assigned to this deployable
        Returns:
        a future signalling the start-up completion
      • undeploy

        public final Future<?> undeploy​(Context context)
        Description copied from interface: Deployable
        Stop the deployable.

        Vert.x calls this method when undeploying this deployable. You do not call it yourself.

        Specified by:
        undeploy in interface Deployable
        Parameters:
        context - the Vert.x context assigned to this deployable
        Returns:
        a future signalling the clean-up completion
      • start

        public void start​(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 startFuture some time later when start up is complete.

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

        public void stop​(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 stopFuture some time later when clean-up is complete.

        Specified by:
        stop in interface Verticle
        Parameters:
        stopPromise - a promise which should be called when verticle clean-up is complete.
        Throws:
        Exception
      • start

        public void start()
                   throws Exception
        If your verticle does a simple, synchronous start-up then override this method and put your start-up code in here.
        Throws:
        Exception
      • stop

        public void stop()
                  throws Exception
        If your verticle has simple synchronous clean-up tasks to complete then override this method and put your clean-up code in here.
        Throws:
        Exception