Skip to content

Commit

Permalink
FISH-10146: Keep all deployment groups.
Browse files Browse the repository at this point in the history
  • Loading branch information
Viii3 committed Dec 3, 2024
1 parent e0afc6a commit 6c283fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -91,7 +91,7 @@ private DomainXmlPreParserException(String s) {
private List<String> configNames = new LinkedList<>();
private Map<String, String> 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;
Expand Down Expand Up @@ -129,14 +129,6 @@ final String getClusterName() {
return cluster.name;
}


final String getDeploymentGroupName() {
if(!validDG) {
return null;
}
return deploymentGroup.name;
}

final List<String> getServerNames() {
if(!valid) {
return null;
Expand All @@ -146,9 +138,16 @@ final List<String> getServerNames() {

final List<String> getDGServerNames() {
if(!validDG) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
return deploymentGroup.dgServerRefs;

Set<String> deploymentGroupNeighbours = new HashSet<>();
deploymentGroups.forEach(groupData -> {
if (groupData.dgServerRefs.contains(instanceName)) {
deploymentGroupNeighbours.addAll(groupData.dgServerRefs);
}
});
return new ArrayList<>(deploymentGroupNeighbours);
}

public Map<String, String> getMapServerConfig() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

0 comments on commit 6c283fa

Please sign in to comment.