public class BareCommand extends ClasspathHandler
| Modifier and Type | Field and Description |
|---|---|
protected String |
clusterHost |
protected int |
clusterPort |
protected String |
clusterPublicHost |
protected int |
clusterPublicPort |
static String |
DEPLOYMENT_OPTIONS_PROP_PREFIX |
protected Runnable |
finalAction |
protected String |
haGroup |
static String |
METRICS_OPTIONS_PROP_PREFIX |
protected VertxOptions |
options |
protected int |
quorum |
protected Vertx |
vertx |
static String |
VERTX_OPTIONS_PROP_PREFIX |
protected String |
vertxOptions |
classpath, log, manager, PATH_SEPexecutionContext, out, systemProperties| Constructor and Description |
|---|
BareCommand() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
addShutdownHook(Vertx vertx,
Logger log,
Runnable action)
Registers a shutdown hook closing the given vert.x instance when the JVM is terminating.
|
protected void |
afterStartingVertx(Vertx instance)
Hook called after starting vert.x.
|
protected void |
beforeStartingVertx(VertxOptions options)
Hook called before starting vert.x.
|
protected void |
configureFromSystemProperties(Object options,
String prefix) |
protected String |
getDefaultAddress() |
boolean |
getHA() |
protected JsonObject |
getJsonFromFileOrString(String jsonFileOrString,
String argName) |
protected MetricsOptions |
getMetricsOptions() |
protected MetricsOptions |
getMetricsOptions(JsonObject jsonObject) |
static Runnable |
getTerminationRunnable(Vertx vertx,
Logger log,
Runnable action)
Gets the termination runnable used to close the Vert.x instance.
|
boolean |
isClustered() |
void |
run()
Starts the vert.x instance.
|
void |
run(Runnable action)
Starts the vert.x instance and sets the final action (called when vert.x is closed).
|
void |
setClusterHost(String host)
Sets the cluster host.
|
void |
setClusterPort(int port)
Sets the cluster port.
|
void |
setClusterPublicHost(String host)
Sets the cluster public host.
|
void |
setClusterPublicPort(int port)
Sets the cluster public port.
|
void |
setExecutionContext(ExecutionContext context)
For testing purpose only.
|
void |
setHAGroup(String group)
Sets the HA group name.
|
void |
setQuorum(int quorum)
Sets the quorum option.
|
void |
setVertxOptions(String vertxOptions)
The Vert.x options, it can be a json file or a json string.
|
protected Vertx |
startVertx()
Starts the vert.x instance.
|
Vertx |
vertx() |
create, create, createClassloader, deploy, newInstance, setClasspathapplySystemProperties, getCwd, out, setCwd, setSystemProps, setUp, tearDownpublic static final String VERTX_OPTIONS_PROP_PREFIX
public static final String DEPLOYMENT_OPTIONS_PROP_PREFIX
public static final String METRICS_OPTIONS_PROP_PREFIX
protected Vertx vertx
protected int clusterPort
protected String clusterHost
protected int clusterPublicPort
protected String clusterPublicHost
protected int quorum
protected String haGroup
protected String vertxOptions
protected VertxOptions options
protected Runnable finalAction
public void setQuorum(int quorum)
quorum - the quorum, default to 1.public void setHAGroup(String group)
group - the name of the group, default to __DEFAULT__.public void setClusterPort(int port)
port - the portpublic void setClusterHost(String host)
host - the cluster hostpublic void setClusterPublicPort(int port)
port - the portpublic void setClusterPublicHost(String host)
host - the hostpublic void setVertxOptions(String vertxOptions)
vertxOptions - the configurationpublic boolean isClustered()
true.public boolean getHA()
true.public void run()
public void run(Runnable action)
action - the action, can be nullprotected Vertx startVertx()
protected JsonObject getJsonFromFileOrString(String jsonFileOrString, String argName)
protected void afterStartingVertx(Vertx instance)
instance - the created vert.x instance.protected void beforeStartingVertx(VertxOptions options)
options - the deployment optionsprotected MetricsOptions getMetricsOptions()
protected MetricsOptions getMetricsOptions(JsonObject jsonObject)
protected void configureFromSystemProperties(Object options, String prefix)
protected static void addShutdownHook(Vertx vertx, Logger log, Runnable action)
Vertx instance.vertx - the vert.x instance, must not be nulllog - the log, must not be nullaction - the action, may be nullpublic static Runnable getTerminationRunnable(Vertx vertx, Logger log, Runnable action)
vertx - the vert.x instance, must not be nulllog - the log, must not be nullaction - the action, may be nullprotected String getDefaultAddress()
public void setExecutionContext(ExecutionContext context)
context - the context to inject for testing.public Vertx vertx()
Copyright © 2020. All rights reserved.