From 8d033f9575d8c3148c1fa4544f074966696f16f7 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 07 Feb 2008 22:12:59 +0000
Subject: [PATCH] Fix some font formatting issues in the setup.
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java | 22 ++++++-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java | 22 ++++++-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java | 9 +-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java | 87 +++++++++++++++++------------
4 files changed, 93 insertions(+), 47 deletions(-)
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java
index ffd8b1c..be311dc 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2007 Sun Microsystems, Inc.
+ * Portions Copyright 2007-2008 Sun Microsystems, Inc.
*/
package org.opends.quicksetup;
@@ -663,10 +663,9 @@
protected void notifyListenersOfLog() {
File logFile = QuickSetupLog.getLogFile();
if (logFile != null) {
- MessageBuilder mb = new MessageBuilder();
- mb.append(INFO_GENERAL_SEE_FOR_DETAILS.get(logFile.getPath()));
- mb.append(formatter.getLineBreak());
- notifyListeners(mb.toMessage());
+ notifyListeners(getFormattedProgress(
+ INFO_GENERAL_SEE_FOR_DETAILS.get(logFile.getPath())));
+ notifyListeners(getLineBreak());
}
}
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 804c934..51a84f4 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
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ * Portions Copyright 2006-2008 Sun Microsystems, Inc.
*/
package org.opends.quicksetup.installer.offline;
@@ -123,12 +123,28 @@
notifyListeners(getTaskSeparator());
}
setCurrentProgressStep(InstallProgressStep.STARTING_SERVER);
+ PointAdder pointAdder = new PointAdder();
if (!isVerbose())
{
- notifyListeners(getFormattedWithPoints(
+ notifyListeners(getFormattedProgress(
INFO_PROGRESS_STARTING_NON_VERBOSE.get()));
+ pointAdder.start();
}
- new ServerController(this).startServer(!isVerbose());
+ try
+ {
+ new ServerController(this).startServer(!isVerbose());
+ }
+ catch (ApplicationException ae)
+ {
+ throw ae;
+ }
+ finally
+ {
+ if (!isVerbose())
+ {
+ pointAdder.stop();
+ }
+ }
if (!isVerbose())
{
notifyListeners(getFormattedDoneWithLineBreak());
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 6c1c7c1..2a893d7 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
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ * Portions Copyright 2006-2008 Sun Microsystems, Inc.
*/
package org.opends.quicksetup.installer.webstart;
@@ -173,12 +173,28 @@
notifyListeners(getTaskSeparator());
}
setCurrentProgressStep(InstallProgressStep.STARTING_SERVER);
+ PointAdder pointAdder = new PointAdder();
if (!isVerbose())
{
- notifyListeners(getFormattedWithPoints(
+ notifyListeners(getFormattedProgress(
INFO_PROGRESS_STARTING_NON_VERBOSE.get()));
+ pointAdder.start();
}
- new ServerController(this).startServer(!isVerbose());
+ try
+ {
+ new ServerController(this).startServer(!isVerbose());
+ }
+ catch (ApplicationException ae)
+ {
+ throw ae;
+ }
+ finally
+ {
+ if (!isVerbose())
+ {
+ pointAdder.stop();
+ }
+ }
if (!isVerbose())
{
notifyListeners(getFormattedDoneWithLineBreak());
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index 3c28426..1c9715b 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2007 Sun Microsystems, Inc.
+ * Portions Copyright 2007-2008 Sun Microsystems, Inc.
*/
package org.opends.quicksetup.util;
@@ -37,6 +37,8 @@
import org.opends.server.util.SetupUtils;
import javax.naming.NamingException;
+import javax.naming.ldap.InitialLdapContext;
+
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
@@ -327,34 +329,27 @@
StartReader errReader = new StartReader(err, startedId, true);
StartReader outputReader = new StartReader(out, startedId, false);
- long finishedTime = 0;
- while (!errReader.isFinished() || !outputReader.isFinished())
- {
- try
- {
- Thread.sleep(100);
- } catch (InterruptedException ie)
- {
- }
+ int returnValue = process.waitFor();
- if (errReader.startedIdFound() || outputReader.startedIdFound())
- {
- /* When we start the server in windows and we are not running it
- * under a windows service, the readers are kept open forever.
- * Once we find that is finished, wait at most 7 seconds.
- */
- if (finishedTime == 0)
- {
- finishedTime = System.currentTimeMillis();
- }
- else
- {
- if (System.currentTimeMillis() - finishedTime > 7000)
- {
- break;
- }
- }
- }
+ LOG.log(Level.INFO, "start-ds return value: "+returnValue);
+
+ if (returnValue != 0)
+ {
+ throw new ApplicationException(ReturnCode.START_ERROR,
+ INFO_ERROR_STARTING_SERVER_CODE.get(
+ String.valueOf(returnValue)), null);
+ }
+ if (outputReader.isFinished())
+ {
+ LOG.log(Level.INFO, "Output reader finished.");
+ }
+ if (errReader.isFinished())
+ {
+ LOG.log(Level.INFO, "Error reader finished.");
+ }
+ if (!outputReader.startedIdFound() && !errReader.startedIdFound())
+ {
+ LOG.log(Level.WARNING, "Started ID could not be found");
}
// Collect any messages found in the output
@@ -396,13 +391,13 @@
{
/*
* There are no exceptions from the readers and they are marked as
- * finished. This means that the server has written in its output the
- * message id informing that it started. So it seems that everything
- * went fine.
+ * finished. So it seems that everything went fine.
*
* However we can have issues with the firewalls or do not have rights
- * to connect. Just check if we can connect to the server.
- * Try 5 times with an interval of 1 second between try.
+ * to connect or since the startup process is asynchronous we will
+ * have to wait for the databases and the listeners to initialize.
+ * Just check if we can connect to the server.
+ * Try 10 times with an interval of 5 seconds between try.
*/
boolean connected = false;
Configuration config = installation.getCurrentConfiguration();
@@ -422,11 +417,12 @@
userPw = null;
}
- for (int i=0; i<5 && !connected; i++)
+ InitialLdapContext ctx = null;
+ for (int i=0; i<10 && !connected; i++)
{
try
{
- Utils.createLdapContext(
+ ctx = Utils.createLdapContext(
ldapUrl,
userDn, userPw, 3000, null);
connected = true;
@@ -434,11 +430,24 @@
catch (NamingException ne)
{
}
+ finally
+ {
+ if (ctx != null)
+ {
+ try
+ {
+ ctx.close();
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+ }
if (!connected)
{
try
{
- Thread.sleep(1000);
+ Thread.sleep(5000);
}
catch (Throwable t)
{
@@ -471,6 +480,11 @@
throw new ApplicationException(
ReturnCode.START_ERROR,
getThrowableMsg(INFO_ERROR_STARTING_SERVER.get(), ioe), ioe);
+ } catch (InterruptedException ie)
+ {
+ throw new ApplicationException(
+ ReturnCode.START_ERROR,
+ getThrowableMsg(INFO_ERROR_STARTING_SERVER.get(), ie), ie);
}
} finally {
if (suppressOutput && StandardOutputSuppressor.isSuppressed()) {
@@ -636,6 +650,7 @@
}
} catch (Throwable t)
{
+ LOG.log(Level.WARNING, "Error reading output: "+t, t);
ex = new ApplicationException(
ReturnCode.START_ERROR,
getThrowableMsg(errorTag, t), t);
--
Gitblit v1.10.0