Skip to content

Commit

Permalink
Merge pull request #3761 from smillidge/PAYARA-3473
Browse files Browse the repository at this point in the history
PAYARA-3473 Make initial wait time configurable with default value of…
  • Loading branch information
arjantijms authored Feb 25, 2019
2 parents 6d89dfc + 47329e0 commit 74add64
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public enum RUNTIME_OPTION {
enablesni(false),
hzpublicaddress(true),
shutdowngrace(true, new IntegerValidator(1, Integer.MAX_VALUE)),
hzinitialjoinwait(true, new IntegerValidator(0,100000)),
contextroot(true);

private RUNTIME_OPTION(boolean hasValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public class PayaraMicroImpl implements PayaraMicroBoot {
private boolean showServletMappings;
private boolean sniEnabled = false;
private String publicAddress = "";
private int initialJoinWait = 1;

/**
* Runs a Payara Micro server used via java -jar payara-micro.jar
Expand Down Expand Up @@ -1357,6 +1358,9 @@ else if (requestTracing[0].matches("\\D+")) {
case shutdowngrace:
System.setProperty(GlassFishImpl.PAYARA_SHUTDOWNGRACE_PROPERTY, value);
break;
case hzinitialjoinwait:
initialJoinWait = Integer.parseInt(value);
break;
case contextroot:
if (contextRoot != null) {
LOGGER.warning("Multiple --contextroot arguments only the last one will apply");
Expand Down Expand Up @@ -1838,8 +1842,14 @@ private void configurePhoneHome() {
}
}


private void configureHazelcast() {
// check hazelcast cluster overrides
// set join wait based on the command flag
if (System.getProperty("hazelcast.wait.seconds.before.join") == null) {
System.setProperty("hazelcast.wait.seconds.before.join", Integer.toString(initialJoinWait));
}

if (noCluster) {
preBootCommands.add(new BootCommand("set", "configs.config.server-config.hazelcast-config-specific-configuration.enabled=false"));
preBootCommands.add(new BootCommand("set", "configs.config.server-config.ejb-container.ejb-timer-service.ejb-timer-service=Dummy"));
Expand Down Expand Up @@ -2118,6 +2128,7 @@ private void setArgumentsFromSystemProperties() {

autoBindHttp = getBooleanProperty("payaramicro.autoBindHttp");
autoBindRange = getIntegerProperty("payaramicro.autoBindRange", 5);
initialJoinWait = getIntegerProperty("payaramicro.initialJoinWait",1);
autoBindSsl = getBooleanProperty("payaramicro.autoBindSsl");
generateLogo = getBooleanProperty("payaramicro.logo");
logToFile = getBooleanProperty("payaramicro.logToFile");
Expand Down Expand Up @@ -2314,6 +2325,7 @@ private void packageUberJar() {
props.setProperty("payaramicro.disablePhoneHome", Boolean.toString(disablePhoneHome));
props.setProperty("payaramicro.showServletMappings", Boolean.toString(showServletMappings));
props.setProperty("payaramicro.sniEnabled", Boolean.toString(sniEnabled));
props.setProperty("payaramicro.initialJoinWait", Integer.toString(initialJoinWait));

if (publicAddress != null) {
props.setProperty("payaramicro.publicAddress", publicAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ interfaces=Specifies the Interfaces that the data grid discovery mode should use
secretsdir=Directory to read secrets files using the Microprofile config api.
showservletmappings=Shows the servlet mappings in the deployment summary message.
hzpublicaddress=Sets the Public Address of the Data Grid for use where NAT translation is used (including in Docker)
hzinitialjoinwait=Set the join wait system property hazelcast.wait.seconds.before.join which is the wait time before joining the cluster
contextroot=Specifies the context root of the first deployment without a context root specified

0 comments on commit 74add64

Please sign in to comment.