Skip to content

Commit

Permalink
KNOX-2977 - The 'conf/descriptors' folder should be considered too wh…
Browse files Browse the repository at this point in the history
…en registering topology port mappings
  • Loading branch information
smolnar82 committed Oct 26, 2023
1 parent ad0ea7d commit 25cce9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,16 +649,10 @@ private synchronized void start() throws Exception {
final ServiceDefinitionRegistry serviceDefinitionRegistry = services.getService(ServiceType.SERVICE_DEFINITION_REGISTRY);
serviceDefinitionRegistry.addServiceDefinitionChangeListener(monitor);

final Collection<Topology> topologies = monitor.getTopologies();
final Map<String, Integer> topologyPortMap = config.getGatewayPortMappings();

// List of all the topology that are deployed
final List<String> deployedTopologyList = new ArrayList<>();

for (final Topology t : topologies) {
deployedTopologyList.add(t.getName());
}

// List of all the topology that are deployed (or will be deployed soon)
final Set<String> deployedTopologyList = gatewayStatusService.collectTopologies(config);

// Check whether the configured topologies for port mapping exist, if not
// log WARN message and continue
Expand Down Expand Up @@ -768,7 +762,7 @@ public static boolean isPortInUse(final int port) {
*/
private void checkMappedTopologiesExist(
final Map<String, Integer> configTopologies,
final List<String> topologies) {
final Set<String> topologies) {
for(final Map.Entry<String, Integer> entry : configTopologies.entrySet()) {
// If the topologies defined in gateway-config.xml are not found in gateway
if (!topologies.contains(entry.getKey())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ public synchronized void initTopologiesToCheck() {
Set<String> healthCheckTopologies = config.getHealthCheckTopologies();
if (healthCheckTopologies.isEmpty()) {
topologyNamesToCheck = collectTopologies(config);
LOG.collectedTopologiesForHealthCheck(topologyNamesToCheck);
} else {
topologyNamesToCheck = healthCheckTopologies;
}
LOG.startingStatusMonitor(topologyNamesToCheck);
}

private Set<String> collectTopologies(GatewayConfig config) {
Set<String> result = new HashSet<>();
public Set<String> collectTopologies(GatewayConfig config) {
final Set<String> result = new HashSet<>();
collectFiles(result, config.getGatewayTopologyDir(), ".xml");
collectFiles(result, config.getGatewayDescriptorsDir(), ".json");
LOG.collectedTopologiesForHealthCheck(result);
return result;
}

Expand Down

0 comments on commit 25cce9f

Please sign in to comment.