From 36d255f8c50c2aa840cc066ae62ae086b73cb288 Mon Sep 17 00:00:00 2001 From: Tim Whittington Date: Wed, 20 Jul 2022 09:10:23 +1200 Subject: [PATCH] DEV: Expand HazelcastPlugin startup time to widen window to expose race conditions on startup. --- .../orient/server/hazelcast/OHazelcastPlugin.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastPlugin.java b/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastPlugin.java index 5e7cd8d356b..dd66af2809d 100755 --- a/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastPlugin.java +++ b/distributed/src/main/java/com/orientechnologies/orient/server/hazelcast/OHazelcastPlugin.java @@ -164,6 +164,17 @@ public void config(final OServer iServer, final OServerParameterConfiguration[] public void startup() { if (!enabled) return; + try { + final String delayEnv = System.getenv("HAZELCAST_PLUGIN_STARTUP_DELAY"); + if (delayEnv != null) { + long delay = Long.parseLong(delayEnv); + OLogManager.instance().info(this, "Delaying HazelcastPlugin startup by '%d' ms", delay); + Thread.sleep(delay); + } + } catch (Throwable t) { + t.printStackTrace(); + } + if (serverInstance.getDatabases() instanceof OrientDBDistributed) ((OrientDBDistributed) serverInstance.getDatabases()).setPlugin(this);