Package io.vertx.launcher.application
Class VertxApplication
- java.lang.Object
-
- io.vertx.launcher.application.VertxApplication
-
public class VertxApplication extends Object
Amain()
class that can be used to create the Vert.x instance and deploy a verticle.It can be used, for example, as the main class of an executable uber-jar, so that you can run verticles directly with:
java -jar myapp.jar
.
-
-
Constructor Summary
Constructors Modifier Constructor Description VertxApplication(String[] args)
Create a new instance with the given program arguments and default behavior (print usage and exit on failure).VertxApplication(String[] args, VertxApplicationHooks hooks)
LikeVertxApplication(String[])
, with the providedhooks
.protected
VertxApplication(String[] args, VertxApplicationHooks hooks, boolean printUsageOnFailure, boolean exitOnFailure)
May be invoked by subclasses to customize behavior.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
launch()
Launches the Vert.x application.static void
main(String[] args)
-
-
-
Constructor Detail
-
VertxApplication
public VertxApplication(String[] args)
Create a new instance with the given program arguments and default behavior (print usage and exit on failure).Subclasses may implement
VertxApplicationHooks
. In this case, this object's hook methods will be invoked at different stages of the launch process.- Parameters:
args
- the program arguments
-
VertxApplication
public VertxApplication(String[] args, VertxApplicationHooks hooks)
LikeVertxApplication(String[])
, with the providedhooks
.- Parameters:
args
- the program argumentshooks
- an instance ofVertxApplicationHooks
to be invoked at different stages of the launch process
-
VertxApplication
protected VertxApplication(String[] args, VertxApplicationHooks hooks, boolean printUsageOnFailure, boolean exitOnFailure)
May be invoked by subclasses to customize behavior.When the
hooks
parameter isnull
, the application instance will be used if it implementsVertxApplicationHooks
.- Parameters:
args
- the program argumentshooks
- an instance ofVertxApplicationHooks
to be invoked at different stages of the launch process (maybe null)printUsageOnFailure
- whether usage should be printed toSystem.out
if the application failed to startexitOnFailure
- whether the JVM should be terminated with a specificexitCode
if the application failed to start
-
-
Method Detail
-
main
public static void main(String[] args)
-
launch
public int launch()
Launches the Vert.x application.- Returns:
- an exit code,
0
means the verticle has been deployed successfully
-
-