From ab6f062e2d1c05f266daca17e9c7597801512be8 Mon Sep 17 00:00:00 2001 From: luiseufrasio Date: Thu, 15 Feb 2024 16:04:13 -0300 Subject: [PATCH 1/3] FISH-7362 : ReplicatedMapCantBeCreatedOnLiteMemberException dispatched from Hazelcast being ignored --- .../src/main/java/org/glassfish/kernel/event/EventsImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nucleus/core/kernel/src/main/java/org/glassfish/kernel/event/EventsImpl.java b/nucleus/core/kernel/src/main/java/org/glassfish/kernel/event/EventsImpl.java index 8f152f0aa4b..aae5550700c 100644 --- a/nucleus/core/kernel/src/main/java/org/glassfish/kernel/event/EventsImpl.java +++ b/nucleus/core/kernel/src/main/java/org/glassfish/kernel/event/EventsImpl.java @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ +// Portions Copyright 2024 Payara Foundation and/or affiliates package org.glassfish.kernel.event; @@ -47,6 +48,8 @@ import java.util.concurrent.ExecutorService; import java.util.logging.Level; import java.util.logging.Logger; + +import com.hazelcast.replicatedmap.ReplicatedMapCantBeCreatedOnLiteMemberException; import jakarta.inject.Inject; import org.glassfish.api.event.EventListener; import org.glassfish.api.event.EventListener.Event; @@ -121,6 +124,7 @@ public void send(final Event event, boolean asynchronously) { public void run() { try { listener.event(event); + } catch(ReplicatedMapCantBeCreatedOnLiteMemberException e) { // Ignore } catch(Throwable e) { logger.log(Level.WARNING, KernelLoggerInfo.exceptionDispatchEvent, e); } From f32e545b820fff15050e494188b20aad613d710e Mon Sep 17 00:00:00 2001 From: luiseufrasio Date: Mon, 19 Feb 2024 11:13:07 -0300 Subject: [PATCH 2/3] FISH-7367 : not calling replicatedMap if is liteMember --- .../src/main/java/org/glassfish/kernel/event/EventsImpl.java | 1 + .../java/fish/payara/nucleus/config/ClusteredConfig.java | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nucleus/core/kernel/src/main/java/org/glassfish/kernel/event/EventsImpl.java b/nucleus/core/kernel/src/main/java/org/glassfish/kernel/event/EventsImpl.java index aae5550700c..2c25418fcc5 100644 --- a/nucleus/core/kernel/src/main/java/org/glassfish/kernel/event/EventsImpl.java +++ b/nucleus/core/kernel/src/main/java/org/glassfish/kernel/event/EventsImpl.java @@ -137,6 +137,7 @@ public void run() { // when synchronous listener throws DeploymentException // we re-throw the exception to abort the deployment throw de; + } catch(ReplicatedMapCantBeCreatedOnLiteMemberException e) { // Ignore } catch (Throwable e) { logger.log(Level.WARNING, KernelLoggerInfo.exceptionDispatchEvent, e); } diff --git a/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/config/ClusteredConfig.java b/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/config/ClusteredConfig.java index fd752d548f2..17958be9151 100644 --- a/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/config/ClusteredConfig.java +++ b/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/config/ClusteredConfig.java @@ -153,9 +153,10 @@ public T getSharedConfiguration(String name, T localValue, Bi public void clearSharedConfiguration(String name) { HazelcastInstance hzInstance = hzCore.getInstance(); if (hzInstance != null) { // can be null during shutdown - String instance = instanceName(hzInstance.getCluster().getLocalMember()); + Member localMember = hzInstance.getCluster().getLocalMember(); + String instance = instanceName(localMember); String mapName = CONFIGURATION_PREFIX + name; - if (instance != null) { + if (instance != null && !localMember.isLiteMember()) { hzInstance.getReplicatedMap(mapName).remove(instance); } } From bf5c28f176a03756bb17e016c170590b45c6e093 Mon Sep 17 00:00:00 2001 From: luiseufrasio Date: Mon, 19 Feb 2024 12:01:32 -0300 Subject: [PATCH 3/3] FISH-7367 : copyright updated --- .../main/java/fish/payara/nucleus/config/ClusteredConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/config/ClusteredConfig.java b/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/config/ClusteredConfig.java index 17958be9151..d9d43f43952 100644 --- a/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/config/ClusteredConfig.java +++ b/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/config/ClusteredConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Payara Foundation and/or its affiliates. All rights reserved. + * Copyright (c) 2020-2024 Payara Foundation 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