From d51eba690902925cd89024bef2800e2232123da6 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 19 Aug 2013 10:32:47 +0000
Subject: [PATCH] Enforced ReplicationServerDomain responsibilities by increasing encapsulation.
---
opends/src/server/org/opends/server/replication/server/ReplicationServer.java | 69 +++++++++-------------------------
1 files changed, 19 insertions(+), 50 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
index d02fe4a..9a136b5 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -399,11 +399,7 @@
for (ReplicationServerDomain domain : getReplicationServerDomains())
{
// Create a normalized set of server URLs.
- final Set<String> connectedReplServers = new HashSet<String>();
- for (String url : domain.getChangelogs())
- {
- connectedReplServers.add(normalizeServerURL(url));
- }
+ final Set<String> connectedRSUrls = getConnectedRSUrls(domain);
/*
* check that all replication server in the config are in the
@@ -440,7 +436,7 @@
// Don't connect to a server if it is already connected.
final String normalizedServerURL = normalizeServerURL(aServerURL);
- if (connectedReplServers.contains(normalizedServerURL))
+ if (connectedRSUrls.contains(normalizedServerURL))
{
continue;
}
@@ -472,6 +468,16 @@
}
}
+ private Set<String> getConnectedRSUrls(ReplicationServerDomain domain)
+ {
+ Set<String> results = new LinkedHashSet<String>();
+ for (ReplicationServerHandler handler : domain.getConnectedRSs().values())
+ {
+ results.add(normalizeServerURL(handler.getServerAddressURL()));
+ }
+ return results;
+ }
+
/**
* Establish a connection to the server with the address and port.
*
@@ -1039,59 +1045,23 @@
// Update threshold value for status analyzers (stop them if requested
// value is 0)
- if (degradedStatusThreshold != configuration
- .getDegradedStatusThreshold())
+ if (degradedStatusThreshold != configuration.getDegradedStatusThreshold())
{
- int oldThresholdValue = degradedStatusThreshold;
- degradedStatusThreshold = configuration
- .getDegradedStatusThreshold();
+ degradedStatusThreshold = configuration.getDegradedStatusThreshold();
for (ReplicationServerDomain domain : getReplicationServerDomains())
{
- if (degradedStatusThreshold == 0)
- {
- // Requested to stop analyzers
- domain.stopStatusAnalyzer();
- }
- else if (domain.isRunningStatusAnalyzer())
- {
- // Update the threshold value for this running analyzer
- domain.updateStatusAnalyzer(degradedStatusThreshold);
- }
- else if (oldThresholdValue == 0)
- {
- // Requested to start analyzers with provided threshold value
- if (domain.getConnectedDSs().size() > 0)
- domain.startStatusAnalyzer();
- }
+ domain.updateDegradedStatusThreshold(degradedStatusThreshold);
}
}
// Update period value for monitoring publishers (stop them if requested
// value is 0)
- if (monitoringPublisherPeriod != configuration
- .getMonitoringPeriod())
+ if (monitoringPublisherPeriod != configuration.getMonitoringPeriod())
{
- long oldMonitoringPeriod = monitoringPublisherPeriod;
monitoringPublisherPeriod = configuration.getMonitoringPeriod();
for (ReplicationServerDomain domain : getReplicationServerDomains())
{
- if (monitoringPublisherPeriod == 0L)
- {
- // Requested to stop monitoring publishers
- domain.stopMonitoringPublisher();
- }
- else if (domain.isRunningMonitoringPublisher())
- {
- // Update the threshold value for this running monitoring publisher
- domain.updateMonitoringPublisher(monitoringPublisherPeriod);
- }
- else if (oldMonitoringPeriod == 0L)
- {
- // Requested to start monitoring publishers with provided period value
- if ((domain.getConnectedDSs().size() > 0)
- || (domain.getConnectedRSs().size() > 0))
- domain.startMonitoringPublisher();
- }
+ domain.updateMonitoringPeriod(monitoringPublisherPeriod);
}
}
@@ -1126,7 +1096,7 @@
return new ConfigChangeResult(ResultCode.SUCCESS, false);
}
- /*
+ /**
* Try and set a sensible URL for this replication server. Since we are
* listening on all addresses there are a couple of potential candidates: 1) a
* matching server url in the replication server's configuration, 2) hostname
@@ -1666,8 +1636,7 @@
}
if (debugEnabled())
- TRACER.debugInfo("In " + this +
- " getEligibleCN() ends with " +
+ TRACER.debugInfo("In " + this + " getEligibleCN() ends with " +
" the following domainEligibleCN for each domain :" + debugLog +
" thus CrossDomainEligibleCN=" + eligibleCN +
" ts=" + new Date(eligibleCN.getTime()).toString());
--
Gitblit v1.10.0