From 2415bae875ebc411a555a5dde2391d173397f547 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 08 Jun 2007 17:07:39 +0000
Subject: [PATCH] Fix for issue 1778 (setup fails during startup of directory server).
---
opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java | 39 ++++++++++++++++++++++++++++++++++-----
1 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index 83a1eab..1e87ab5 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -303,7 +303,6 @@
try
{
String startedId = getStartedId();
-
Process process = pb.start();
BufferedReader err =
@@ -314,6 +313,7 @@
StartReader errReader = new StartReader(err, startedId, true);
StartReader outputReader = new StartReader(out, startedId, false);
+ long finishedTime = 0;
while (!errReader.isFinished() || !outputReader.isFinished())
{
try
@@ -322,6 +322,25 @@
} catch (InterruptedException ie)
{
}
+
+ 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;
+ }
+ }
+ }
}
// Collect any messages found in the output
@@ -532,6 +551,8 @@
private boolean isFinished;
+ private boolean startedIdFound;
+
private boolean isFirstLine;
/**
@@ -577,9 +598,10 @@
isFirstLine = false;
}
LOG.log(Level.INFO, "server: " + line);
- if (line.indexOf("id=" + startedId) != -1)
+ if (line.toLowerCase().indexOf("=" + startedId) != -1)
{
isFinished = true;
+ startedIdFound = true;
}
messages.add(line);
@@ -624,10 +646,17 @@
{
return isFinished;
}
- }
- private String getMsg(String key) {
- return ResourceProvider.getInstance().getMsg(key);
+ /**
+ * Returns <CODE>true</CODE> if the server start Id was found and
+ * <CODE>false</CODE> otherwise.
+ * @return <CODE>true</CODE> if the server start Id was found and
+ * <CODE>false</CODE> otherwise.
+ */
+ public boolean startedIdFound()
+ {
+ return startedIdFound;
+ }
}
private String getMsg(String key, String... args) {
--
Gitblit v1.10.0