Top Description Fields Constructors Methods
io.vertx.core

public Class Launcher

extends VertxCommandLauncher
implements VertxLifecycleHooks
Class Inheritance
All Implemented Interfaces
io.vertx.core.impl.launcher.VertxLifecycleHooks
Imports
io.vertx.core.impl.launcher.VertxCommandLauncher, .VertxLifecycleHooks, io.vertx.core.json.JsonObject

A main() class that can be used to create Vert.x instance and deploy a verticle, or run a bare Vert.x instance.

This class is used by the vertx command line utility to deploy verticles from the command line. It is extensible as "commands" can be added using the io.vertx.core.spi.launcher.CommandFactory SPI.

E.g.

vertx run myverticle.js vertx my-command ...

It can also be used as the main class of an executable jar so you can run verticles directly with:

java -jar myapp.jar

Author
Clement Escoffier

Field Summary

Inherited from io.vertx.core.impl.launcher.VertxCommandLauncher:
commandByNamelookupsmainPROCESS_ARGS

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterConfigParsed(JsonObject
the read config, empty if none are provided.
config
)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.afterConfigParsed.

References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Hook for sub-classes of Launcher after the config has been parsed.

public void
afterStartingVertx(Vertx
the created Vert.x instance
vertx
)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.afterStartingVertx.

Hook for sub-classes of Launcher after the vertx instance is started.

public void
afterStoppingVertx()

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.afterStoppingVertx.

Hook for sub classes of the io.vertx.core.Launcher class called after the Vertx instance has been terminated.

public void
beforeDeployingVerticle(DeploymentOptions
the current deployment options. Modify them to customize the deployment.
deploymentOptions
)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.beforeDeployingVerticle.

Hook for sub-classes of Launcher before the verticle is deployed.

public void
beforeStartingVertx(VertxOptions
the configured Vert.x options. Modify them to customize the Vert.x instance.
options
)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.beforeStartingVertx.

Hook for sub-classes of Launcher before the vertx instance is started.

public void
beforeStoppingVertx(Vertx
the Vertx instance, cannot be null
vertx
)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.beforeStoppingVertx.

Hook for sub classes of the io.vertx.core.Launcher class called before the Vertx instance is terminated.

public static void
executeCommand(String
the command
cmd
,
String...
the arguments
args
)

Utility method to execute a specific command.

public void
handleDeployFailed(Vertx
the vert.x instance
vertx
,
String
the verticle
mainVerticle
,
DeploymentOptions
the verticle deployment options
deploymentOptions
,
Throwable
the cause of the failure
cause
)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.handleDeployFailed.

A deployment failure has been encountered.

public static void
main(String[]
the user command line arguments.
args
)

Main entry point.

Inherited from io.vertx.core.impl.launcher.VertxCommandLauncher:
dispatchdispatchexecutegetCommandFromManifestgetCommandLinePrefixgetCommandNamesgetDefaultCommandgetExistingCommandInstancegetMainVerticlegetNewCommandInstancegetPrintStreamgetProcessArgumentsisAskingForHelpisAskingForVersionloadprintCommandNotFoundprintCommandUsageprintGenericExecutionErrorprintGlobalUsageprintSpecificExceptionregisterregisterregisterresetProcessArgumentsunregister

Constructor Detail

Launcherback to summary
public Launcher()

Method Detail

afterConfigParsedback to summary
public void afterConfigParsed(JsonObject config)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.afterConfigParsed.

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Hook for sub-classes of Launcher after the config has been parsed.

Parameters
config:JsonObject

the read config, empty if none are provided.

afterStartingVertxback to summary
public void afterStartingVertx(Vertx vertx)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.afterStartingVertx.

Hook for sub-classes of Launcher after the vertx instance is started.

Parameters
vertx:Vertx

the created Vert.x instance

afterStoppingVertxback to summary
public void afterStoppingVertx()

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.afterStoppingVertx.

Doc from io.vertx.core.impl.launcher.VertxLifecycleHooks.afterStoppingVertx.

Hook for sub classes of the io.vertx.core.Launcher class called after the Vertx instance has been terminated. The hook is called after the Vertx#close() method.

Annotations
@Override
beforeDeployingVerticleback to summary
public void beforeDeployingVerticle(DeploymentOptions deploymentOptions)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.beforeDeployingVerticle.

Hook for sub-classes of Launcher before the verticle is deployed.

Parameters
deploymentOptions:DeploymentOptions

the current deployment options. Modify them to customize the deployment.

beforeStartingVertxback to summary
public void beforeStartingVertx(VertxOptions options)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.beforeStartingVertx.

Hook for sub-classes of Launcher before the vertx instance is started.

Parameters
options:VertxOptions

the configured Vert.x options. Modify them to customize the Vert.x instance.

beforeStoppingVertxback to summary
public void beforeStoppingVertx(Vertx vertx)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.beforeStoppingVertx.

Doc from io.vertx.core.impl.launcher.VertxLifecycleHooks.beforeStoppingVertx.

Hook for sub classes of the io.vertx.core.Launcher class called before the Vertx instance is terminated. The hook is called during the Vertx#close() method.

Parameters
vertx:Vertx

the Vertx instance, cannot be null

Annotations
@Override
executeCommandback to summary
public static void executeCommand(String cmd, String... args)

Utility method to execute a specific command.

Parameters
cmd:String

the command

args:String[]

the arguments

handleDeployFailedback to summary
public void handleDeployFailed(Vertx vertx, String mainVerticle, DeploymentOptions deploymentOptions, Throwable cause)

Implements io.vertx.core.impl.launcher.VertxLifecycleHooks.handleDeployFailed.

A deployment failure has been encountered. You can override this method to customize the behavior. By default it closes the `vertx` instance.

Parameters
vertx:Vertx

the vert.x instance

mainVerticle:String

the verticle

deploymentOptions:DeploymentOptions

the verticle deployment options

cause:Throwable

the cause of the failure

mainback to summary
public static void main(String[] args)

Main entry point.

Parameters
args:String[]

the user command line arguments.