public class Launcher
extends io.vertx.core.impl.launcher.VertxCommandLauncher
implements io.vertx.core.impl.launcher.VertxLifecycleHooks
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 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
commandByName, lookups, main, PROCESS_ARGS
DEFAULT_ARG_NAME, DEFAULT_DESC_PAD, DEFAULT_LEFT_PAD, DEFAULT_LONG_OPT_PREFIX, DEFAULT_LONG_OPT_SEPARATOR, DEFAULT_OPT_PREFIX, DEFAULT_USAGE_PREFIX, DEFAULT_WIDTH, optionComparator
Constructor and Description |
---|
Launcher() |
Modifier and Type | Method and Description |
---|---|
void |
afterConfigParsed(JsonObject config)
Hook for sub-classes of
Launcher after the config has been parsed. |
void |
afterStartingVertx(Vertx vertx)
Hook for sub-classes of
Launcher after the vertx instance is started. |
void |
afterStoppingVertx()
|
void |
beforeDeployingVerticle(DeploymentOptions deploymentOptions)
Hook for sub-classes of
Launcher before the verticle is deployed. |
void |
beforeStartingVertx(VertxOptions options)
Hook for sub-classes of
Launcher before the vertx instance is started. |
void |
beforeStoppingVertx(Vertx vertx)
|
static void |
executeCommand(String cmd,
String... args)
Utility method to execute a specific command.
|
void |
handleDeployFailed(Vertx vertx,
String mainVerticle,
DeploymentOptions deploymentOptions,
Throwable cause)
A deployment failure has been encountered.
|
static void |
main(String[] args)
Main entry point.
|
dispatch, dispatch, execute, getCommandFromManifest, getCommandLinePrefix, getCommandNames, getDefaultCommand, getExistingCommandInstance, getMainVerticle, getNewCommandInstance, getPrintStream, getProcessArguments, isAskingForHelp, isAskingForVersion, load, printCommandNotFound, printCommandUsage, printGenericExecutionError, printGlobalUsage, printSpecificException, register, register, register, resetProcessArguments, unregister
appendArgument, appendOption, buildWrapped, buildWrapped, computeOptionsAndArguments, computeUsage, computeUsageLine, createPadding, findWrapPos, getArgName, getDescPadding, getLeftPadding, getLongOptionPrefix, getLongOptionSeparator, getNewLine, getOptionComparator, getOptionPrefix, getUsagePrefix, getWidth, isNullOrEmpty, renderCommands, renderOptionsAndArguments, renderWrappedText, renderWrappedTextBlock, rtrim, setArgName, setDescPadding, setLeftPadding, setLongOptionPrefix, setLongOptionSeparator, setNewLine, setOptionComparator, setOptionPrefix, setUsagePrefix, setWidth, usage, usage
public static void main(String[] args)
args
- the user command line arguments.public static void executeCommand(String cmd, String... args)
cmd
- the commandargs
- the argumentspublic void afterConfigParsed(JsonObject config)
Launcher
after the config has been parsed.afterConfigParsed
in interface io.vertx.core.impl.launcher.VertxLifecycleHooks
config
- the read config, empty if none are provided.public void beforeStartingVertx(VertxOptions options)
Launcher
before the vertx instance is started.beforeStartingVertx
in interface io.vertx.core.impl.launcher.VertxLifecycleHooks
options
- the configured Vert.x options. Modify them to customize the Vert.x instance.public void afterStartingVertx(Vertx vertx)
Launcher
after the vertx instance is started.afterStartingVertx
in interface io.vertx.core.impl.launcher.VertxLifecycleHooks
vertx
- the created Vert.x instancepublic void beforeDeployingVerticle(DeploymentOptions deploymentOptions)
Launcher
before the verticle is deployed.beforeDeployingVerticle
in interface io.vertx.core.impl.launcher.VertxLifecycleHooks
deploymentOptions
- the current deployment options. Modify them to customize the deployment.public void beforeStoppingVertx(Vertx vertx)
io.vertx.core.impl.launcher.VertxLifecycleHooks
Launcher
class called before the Vertx
instance is
terminated. The hook is called during the Vertx.close()
method.beforeStoppingVertx
in interface io.vertx.core.impl.launcher.VertxLifecycleHooks
vertx
- the Vertx
instance, cannot be null
public void afterStoppingVertx()
io.vertx.core.impl.launcher.VertxLifecycleHooks
Launcher
class called after the Vertx
instance has been
terminated. The hook is called after the Vertx.close()
method.afterStoppingVertx
in interface io.vertx.core.impl.launcher.VertxLifecycleHooks
public void handleDeployFailed(Vertx vertx, String mainVerticle, DeploymentOptions deploymentOptions, Throwable cause)
handleDeployFailed
in interface io.vertx.core.impl.launcher.VertxLifecycleHooks
vertx
- the vert.x instancemainVerticle
- the verticledeploymentOptions
- the verticle deployment optionscause
- the cause of the failureCopyright © 2021 Eclipse. All rights reserved.