From 41804a64bce10f1df08adfae02034d30e9ed3c2b Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 03 Sep 2007 07:51:16 +0000
Subject: [PATCH] Add some log messages in the initialization code.
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 170 +++++++++++++++++++++++++-----------------
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java | 20 +++-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java | 12 +-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java | 12 +-
4 files changed, 127 insertions(+), 87 deletions(-)
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index f26e545..acf6957 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -1757,9 +1757,18 @@
ServerDescriptor server = replica.getServer();
String hostPort = server.getHostPort(true);
- notifyListeners(getFormattedProgress(
- INFO_PROGRESS_INITIALIZING_SUFFIX.get(dn, hostPort)));
- notifyListeners(getLineBreak());
+ boolean isADS = areDnsEqual(dn, ADSContext.getAdministrationSuffixDN());
+ if(!isADS)
+ {
+ notifyListeners(getFormattedProgress(
+ INFO_PROGRESS_INITIALIZING_SUFFIX.get(dn, hostPort)));
+ notifyListeners(getLineBreak());
+ }
+ else
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_INITIALIZING_ADS.get()));
+ }
try
{
int replicationId = replica.getReplicationId();
@@ -1811,7 +1820,11 @@
{
try
{
- initializeSuffix(ctx, replicationId, dn, true, hostPort);
+ LOG.log(Level.INFO, "Calling initializeSuffix with base DN: "+dn);
+ LOG.log(Level.INFO, "Try number: "+(6 - nTries));
+ LOG.log(Level.INFO, "replicationId of source replica: "+
+ replicationId);
+ initializeSuffix(ctx, replicationId, dn, !isADS, hostPort);
initDone = true;
}
catch (PeerNotFoundException pnfe)
@@ -1848,6 +1861,10 @@
}
throw ae;
}
+ if (isADS)
+ {
+ notifyListeners(getFormattedDone());
+ }
notifyListeners(getLineBreak());
checkAbort();
}
@@ -3666,6 +3683,7 @@
}
catch (NameAlreadyBoundException x)
{
+ LOG.log(Level.WARNING, "A task with dn: "+dn+" already existed.");
}
catch (NamingException ne)
{
@@ -3694,6 +3712,7 @@
Message lastDisplayedMsg = null;
String lastLogMsg = null;
long lastTimeMsgDisplayed = -1;
+ long lastTimeMsgLogged = -1;
int totalEntries = 0;
while (!isOver)
{
@@ -3708,78 +3727,84 @@
{
NamingEnumeration res = ctx.search(dn, filter, searchControls);
SearchResult sr = (SearchResult)res.next();
- if (displayProgress)
- {
- // Display the number of entries that have been handled and
- // a percentage...
- Message msg;
- String sProcessed = getFirstValue(sr,
- "ds-task-processed-entry-count");
- String sUnprocessed = getFirstValue(sr,
- "ds-task-unprocessed-entry-count");
- int processed = -1;
- int unprocessed = -1;
- if (sProcessed != null)
- {
- processed = Integer.parseInt(sProcessed);
- }
- if (sUnprocessed != null)
- {
- unprocessed = Integer.parseInt(sUnprocessed);
- }
- totalEntries = Math.max(totalEntries, processed+unprocessed);
- if ((processed != -1) && (unprocessed != -1))
+ // Get the number of entries that have been handled and
+ // a percentage...
+ Message msg;
+ String sProcessed = getFirstValue(sr,
+ "ds-task-processed-entry-count");
+ String sUnprocessed = getFirstValue(sr,
+ "ds-task-unprocessed-entry-count");
+ int processed = -1;
+ int unprocessed = -1;
+ if (sProcessed != null)
+ {
+ processed = Integer.parseInt(sProcessed);
+ }
+ if (sUnprocessed != null)
+ {
+ unprocessed = Integer.parseInt(sUnprocessed);
+ }
+ totalEntries = Math.max(totalEntries, processed+unprocessed);
+
+ if ((processed != -1) && (unprocessed != -1))
+ {
+ if (processed + unprocessed > 0)
{
- if (processed + unprocessed > 0)
- {
- int perc = (100 * processed) / (processed + unprocessed);
- msg = INFO_INITIALIZE_PROGRESS_WITH_PERCENTAGE.get(sProcessed,
- String.valueOf(perc));
- }
- else
- {
- //msg = INFO_NO_ENTRIES_TO_INITIALIZE.get();
- msg = null;
- }
- }
- else if (processed != -1)
- {
- msg = INFO_INITIALIZE_PROGRESS_WITH_PROCESSED.get(sProcessed);
- }
- else if (unprocessed != -1)
- {
- msg = INFO_INITIALIZE_PROGRESS_WITH_UNPROCESSED.get(sUnprocessed);
+ int perc = (100 * processed) / (processed + unprocessed);
+ msg = INFO_INITIALIZE_PROGRESS_WITH_PERCENTAGE.get(sProcessed,
+ String.valueOf(perc));
}
else
{
- msg = lastDisplayedMsg;
+ //msg = INFO_NO_ENTRIES_TO_INITIALIZE.get();
+ msg = null;
}
+ }
+ else if (processed != -1)
+ {
+ msg = INFO_INITIALIZE_PROGRESS_WITH_PROCESSED.get(sProcessed);
+ }
+ else if (unprocessed != -1)
+ {
+ msg = INFO_INITIALIZE_PROGRESS_WITH_UNPROCESSED.get(sUnprocessed);
+ }
+ else
+ {
+ msg = lastDisplayedMsg;
+ }
- if (msg != null)
+ if (msg != null)
+ {
+ long currentTime = System.currentTimeMillis();
+ /* Refresh period: to avoid having too many lines in the log */
+ long minRefreshPeriod;
+ if (totalEntries < 100)
{
- long currentTime = System.currentTimeMillis();
- /* Refresh period: to avoid having too many lines in the log */
- long minRefreshPeriod;
- if (totalEntries < 100)
- {
- minRefreshPeriod = 0;
- }
- else if (totalEntries < 1000)
- {
- minRefreshPeriod = 1000;
- }
- else if (totalEntries < 10000)
- {
- minRefreshPeriod = 5000;
- }
- else
- {
- minRefreshPeriod = 10000;
- }
+ minRefreshPeriod = 0;
+ }
+ else if (totalEntries < 1000)
+ {
+ minRefreshPeriod = 1000;
+ }
+ else if (totalEntries < 10000)
+ {
+ minRefreshPeriod = 5000;
+ }
+ else
+ {
+ minRefreshPeriod = 10000;
+ }
+ if (((currentTime - minRefreshPeriod) > lastTimeMsgLogged))
+ {
+ lastTimeMsgLogged = currentTime;
+ LOG.log(Level.INFO, "Progress msg: "+msg);
+ }
+ if (displayProgress)
+ {
if (!msg.equals(lastDisplayedMsg) &&
- ((currentTime - minRefreshPeriod) > lastTimeMsgDisplayed))
- if (!msg.equals(lastDisplayedMsg))
+ ((currentTime - minRefreshPeriod) > lastTimeMsgDisplayed) &&
+ !msg.equals(lastDisplayedMsg))
{
notifyListeners(getFormattedProgress(msg));
lastDisplayedMsg = msg;
@@ -3788,6 +3813,7 @@
}
}
}
+
String logMsg = getFirstValue(sr, "ds-task-log-message");
if (logMsg != null)
{
@@ -3816,9 +3842,13 @@
sourceServerDisplay);
}
+ LOG.log(Level.WARNING, "Processed errorMsg: "+errorMsg);
if (helper.isCompletedWithErrors(state))
{
- notifyListeners(getFormattedWarning(errorMsg));
+ if (displayProgress)
+ {
+ notifyListeners(getFormattedWarning(errorMsg));
+ }
}
else if (!helper.isSuccessful(state) ||
helper.isStoppedByError(state))
@@ -3829,16 +3859,20 @@
if ((lastLogMsg == null) ||
helper.isPeersNotFoundError(lastLogMsg))
{
+ LOG.log(Level.WARNING, "Throwing peer not found error. "+
+ "Last Log Msg: "+lastLogMsg);
// Assume that this is a peer not found error.
throw new PeerNotFoundException(errorMsg);
}
else
{
+ LOG.log(Level.SEVERE, "Throwing ApplicationException.");
throw ae;
}
}
else if (displayProgress)
{
+ LOG.log(Level.INFO, "Initialization completed successfully.");
notifyListeners(getFormattedProgress(
INFO_SUFFIX_INITIALIZED_SUCCESSFULLY.get()));
}
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java
index d5b543b..88a553b 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java
@@ -28,7 +28,7 @@
package org.opends.quicksetup.installer;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Set;
import org.opends.admin.ads.SuffixDescriptor;
@@ -86,13 +86,13 @@
{
case REPLICATE_WITH_EXISTING_SUFFIXES:
Set s = (Set)args[0];
- availableSuffixes = new HashSet<SuffixDescriptor>();
+ availableSuffixes = new LinkedHashSet<SuffixDescriptor>();
for (Object o: s)
{
availableSuffixes.add((SuffixDescriptor)o);
}
s = (Set)args[1];
- suffixesToReplicate = new HashSet<SuffixDescriptor>();
+ suffixesToReplicate = new LinkedHashSet<SuffixDescriptor>();
for (Object o: s)
{
suffixesToReplicate.add((SuffixDescriptor)o);
@@ -104,13 +104,13 @@
if ((args != null) && (args.length > 0))
{
s = (Set)args[0];
- availableSuffixes = new HashSet<SuffixDescriptor>();
+ availableSuffixes = new LinkedHashSet<SuffixDescriptor>();
for (Object o: s)
{
availableSuffixes.add((SuffixDescriptor)o);
}
s = (Set)args[1];
- suffixesToReplicate = new HashSet<SuffixDescriptor>();
+ suffixesToReplicate = new LinkedHashSet<SuffixDescriptor>();
for (Object o: s)
{
suffixesToReplicate.add((SuffixDescriptor)o);
@@ -138,7 +138,10 @@
*/
public Set<SuffixDescriptor> getAvailableSuffixes()
{
- return availableSuffixes;
+ LinkedHashSet<SuffixDescriptor> copy =
+ new LinkedHashSet<SuffixDescriptor>();
+ copy.addAll(availableSuffixes);
+ return copy;
}
/**
@@ -149,7 +152,10 @@
*/
public Set<SuffixDescriptor> getSuffixes()
{
- return suffixesToReplicate;
+ LinkedHashSet<SuffixDescriptor> copy =
+ new LinkedHashSet<SuffixDescriptor>();
+ copy.addAll(suffixesToReplicate);
+ return copy;
}
}
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index 0570855..470b427 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -375,18 +375,18 @@
steps.add(InstallProgressStep.STARTING_SERVER);
}
- if (mustConfigureReplication())
- {
- steps.add(InstallProgressStep.CONFIGURING_REPLICATION);
- totalTime += hmTime.get(InstallProgressStep.CONFIGURING_REPLICATION);
- }
-
if (mustCreateAds())
{
totalTime += hmTime.get(InstallProgressStep.CONFIGURING_ADS);
steps.add(InstallProgressStep.CONFIGURING_ADS);
}
+ if (mustConfigureReplication())
+ {
+ steps.add(InstallProgressStep.CONFIGURING_REPLICATION);
+ totalTime += hmTime.get(InstallProgressStep.CONFIGURING_REPLICATION);
+ }
+
if (mustInitializeSuffixes())
{
totalTime += hmTime.get(
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index 2a34f8a..903fa45 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -352,18 +352,18 @@
steps.add(InstallProgressStep.STARTING_SERVER);
}
- if (mustConfigureReplication())
- {
- steps.add(InstallProgressStep.CONFIGURING_REPLICATION);
- totalTime += hmTime.get(InstallProgressStep.CONFIGURING_REPLICATION);
- }
-
if (mustCreateAds())
{
totalTime += hmTime.get(InstallProgressStep.CONFIGURING_ADS);
steps.add(InstallProgressStep.CONFIGURING_ADS);
}
+ if (mustConfigureReplication())
+ {
+ steps.add(InstallProgressStep.CONFIGURING_REPLICATION);
+ totalTime += hmTime.get(InstallProgressStep.CONFIGURING_REPLICATION);
+ }
+
if (mustInitializeSuffixes())
{
totalTime += hmTime.get(
--
Gitblit v1.10.0