From 6c283faf788f1085bbfc7d8dcb620e21cb6200bd Mon Sep 17 00:00:00 2001 From: Rhys Williams <170514543+Viii3@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:15:10 +0000 Subject: [PATCH] FISH-10146: Keep all deployment groups. --- .../config/support/DomainXmlPreParser.java | 23 +++++++++---------- .../config/support/InstanceReaderFilter.java | 19 +-------------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/DomainXmlPreParser.java b/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/DomainXmlPreParser.java index 1ee661538bd..1e5c16e80ec 100644 --- a/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/DomainXmlPreParser.java +++ b/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/DomainXmlPreParser.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -// Portions Copyright [2018-2023] Payara Foundation and/or affiliates +// Portions Copyright [2018-2024] Payara Foundation and/or affiliates package org.glassfish.config.support; @@ -91,7 +91,7 @@ private DomainXmlPreParserException(String s) { private List configNames = new LinkedList<>(); private Map mapServerConfig = new HashMap<>(); private ClusterData cluster; - private DeploymentGroupData deploymentGroup; + private DeploymentGroupData deploymentGroup; // Refers to the FIRST deployment group for this instance. private String instanceName; private String serverConfigRef; private boolean valid = false; @@ -129,14 +129,6 @@ final String getClusterName() { return cluster.name; } - - final String getDeploymentGroupName() { - if(!validDG) { - return null; - } - return deploymentGroup.name; - } - final List getServerNames() { if(!valid) { return null; @@ -146,9 +138,16 @@ final List getServerNames() { final List getDGServerNames() { if(!validDG) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } - return deploymentGroup.dgServerRefs; + + Set deploymentGroupNeighbours = new HashSet<>(); + deploymentGroups.forEach(groupData -> { + if (groupData.dgServerRefs.contains(instanceName)) { + deploymentGroupNeighbours.addAll(groupData.dgServerRefs); + } + }); + return new ArrayList<>(deploymentGroupNeighbours); } public Map getMapServerConfig() { diff --git a/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/InstanceReaderFilter.java b/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/InstanceReaderFilter.java index 19305f9be10..d3e87c464d4 100644 --- a/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/InstanceReaderFilter.java +++ b/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/InstanceReaderFilter.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -// Portions Copyright [2018-2023] Payara Foundation and/or affiliates +// Portions Copyright [2018-2024] Payara Foundation and/or affiliates package org.glassfish.config.support; @@ -98,10 +98,6 @@ final boolean filterOut() throws XMLStreamException { if (elementName.equals(CLUSTER)){ return handleCluster(reader); } - - if (elementName.equals(DEPLOYMENT_GROUP)){ - return handleDeploymentGroup(reader); - } // keep everything else return false; @@ -160,19 +156,6 @@ private boolean handleCluster(XMLStreamReader reader) { return !(StringUtils.ok(myCluster) && myCluster.equals(name)); } - /** - * Note that dxpp.getClusterName() will definitely return null - * for stand-alone instances. This is normal. - * - * @return true if we want to filter out this DEPLOYMENT GROUP element - */ - private boolean handleDeploymentGroup(XMLStreamReader reader) { - String name = reader.getAttributeValue(null, NAME); - String myDG = dxpp.getDeploymentGroupName(); - - return !(StringUtils.ok(myDG) && myDG.equals(name)); - } - private final DomainXmlPreParser dxpp; private final String instanceName; }