From 25e046c7a8de8fcbdeabc18832046718799f956d Mon Sep 17 00:00:00 2001 From: luiseufrasio Date: Thu, 27 Oct 2022 14:14:34 -0300 Subject: [PATCH] FISH-6495 : setting hazelcast property when passed --- .../java/org/glassfish/embeddable/GlassFishRuntime.java | 6 +++++- .../fish/payara/nucleus/hazelcast/HazelcastCore.java | 9 ++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/nucleus/common/simple-glassfish-api/src/main/java/org/glassfish/embeddable/GlassFishRuntime.java b/nucleus/common/simple-glassfish-api/src/main/java/org/glassfish/embeddable/GlassFishRuntime.java index 0f1e8567535..57d75e65ca2 100644 --- a/nucleus/common/simple-glassfish-api/src/main/java/org/glassfish/embeddable/GlassFishRuntime.java +++ b/nucleus/common/simple-glassfish-api/src/main/java/org/glassfish/embeddable/GlassFishRuntime.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009-2022 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -93,6 +93,10 @@ public static GlassFishRuntime bootstrap() throws GlassFishException { * @throws GlassFishException */ public static GlassFishRuntime bootstrap(BootstrapProperties bootstrapProperties) throws GlassFishException { + String hazelcastProperty = bootstrapProperties.getProperty("hazelcast.config"); + if (hazelcastProperty != null) { + System.setProperty("hazelcast.config", hazelcastProperty); + } return bootstrap(bootstrapProperties, GlassFishRuntime.class.getClassLoader()); } diff --git a/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/hazelcast/HazelcastCore.java b/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/hazelcast/HazelcastCore.java index b917ce95e42..0f1462b3f0e 100644 --- a/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/hazelcast/HazelcastCore.java +++ b/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/hazelcast/HazelcastCore.java @@ -308,16 +308,11 @@ public void setEnabled(Boolean enabled) { private Config buildConfiguration() { Config config = new Config(); String hazelcastFilePath = ""; - URL serverConfigURL; try { - serverConfigURL = new URL(context.getServerConfigURL()); Boolean isChangeToDefault = Boolean.valueOf(configuration.getChangeToDefault()); - File serverConfigFile = new File(serverConfigURL.getPath()); - if (new File(configuration.getHazelcastConfigurationFile()).exists()) { + hazelcastFilePath = System.getProperty("hazelcast.config"); + if (hazelcastFilePath == null || hazelcastFilePath.isEmpty()) { hazelcastFilePath = configuration.getHazelcastConfigurationFile(); - } else { - hazelcastFilePath = serverConfigFile.getParentFile().getAbsolutePath() + File.separator - + configuration.getHazelcastConfigurationFile(); } File file = new File(hazelcastFilePath); if (file.exists()) {