diff --git a/appserver/extras/payara-micro/payara-micro-core/src/main/java/fish/payara/micro/cmd/options/RUNTIME_OPTION.java b/appserver/extras/payara-micro/payara-micro-core/src/main/java/fish/payara/micro/cmd/options/RUNTIME_OPTION.java index b24cb1191ff..f789f134eb6 100644 --- a/appserver/extras/payara-micro/payara-micro-core/src/main/java/fish/payara/micro/cmd/options/RUNTIME_OPTION.java +++ b/appserver/extras/payara-micro/payara-micro-core/src/main/java/fish/payara/micro/cmd/options/RUNTIME_OPTION.java @@ -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) { diff --git a/appserver/extras/payara-micro/payara-micro-core/src/main/java/fish/payara/micro/impl/PayaraMicroImpl.java b/appserver/extras/payara-micro/payara-micro-core/src/main/java/fish/payara/micro/impl/PayaraMicroImpl.java index 1410c1fa223..2e5442783a7 100644 --- a/appserver/extras/payara-micro/payara-micro-core/src/main/java/fish/payara/micro/impl/PayaraMicroImpl.java +++ b/appserver/extras/payara-micro/payara-micro-core/src/main/java/fish/payara/micro/impl/PayaraMicroImpl.java @@ -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 @@ -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"); @@ -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")); @@ -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"); @@ -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); diff --git a/appserver/extras/payara-micro/payara-micro-core/src/main/resources/commandoptions.properties b/appserver/extras/payara-micro/payara-micro-core/src/main/resources/commandoptions.properties index 7146b5f939e..803edc8df7d 100644 --- a/appserver/extras/payara-micro/payara-micro-core/src/main/resources/commandoptions.properties +++ b/appserver/extras/payara-micro/payara-micro-core/src/main/resources/commandoptions.properties @@ -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