mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
07.12.2008 d7c9c39d82f9a323ca0056c37bc2a0656dc740f2
Fix some font formatting issues in the setup.

Try to minimize the cases where issue 2915 can affect to the setup by trying to reconnect more often to the server after it is started.

Since the start can take long, use the same point mechanism to show progress in non verbose mode we use for the import. This way the user does not have the impression that we are stuck on the start.
4 files modified
126 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/Application.java 9 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 20 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 20 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java 77 ●●●●● patch | view | raw | blame | history
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());
    }
  }
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();
        }
        try
        {
        new ServerController(this).startServer(!isVerbose());
        }
        catch (ApplicationException ae)
        {
          throw ae;
        }
        finally
        {
          if (!isVerbose())
          {
            pointAdder.stop();
          }
        }
        if (!isVerbose())
        {
          notifyListeners(getFormattedDoneWithLineBreak());
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();
        }
        try
        {
        new ServerController(this).startServer(!isVerbose());
        }
        catch (ApplicationException ae)
        {
          throw ae;
        }
        finally
        {
          if (!isVerbose())
          {
            pointAdder.stop();
          }
        }
        if (!isVerbose())
        {
          notifyListeners(getFormattedDoneWithLineBreak());
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())
        LOG.log(Level.INFO, "start-ds return value: "+returnValue);
        if (returnValue != 0)
          {
            /* 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)
          throw new ApplicationException(ReturnCode.START_ERROR,
              INFO_ERROR_STARTING_SERVER_CODE.get(
                  String.valueOf(returnValue)), null);
        }
        if (outputReader.isFinished())
            {
              finishedTime = System.currentTimeMillis();
          LOG.log(Level.INFO, "Output reader finished.");
            }
            else
        if (errReader.isFinished())
            {
              if (System.currentTimeMillis() - finishedTime > 7000)
          LOG.log(Level.INFO, "Error reader finished.");
        }
        if (!outputReader.startedIdFound() && !errReader.startedIdFound())
              {
                break;
              }
            }
          }
          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);