/**
   * Shuts down the logging process using the specified mode.
   *
   * <p>
   *
   * @param closemode The mode in which to shut down the logging process
   *     <OL>
   *       <LI>closemode -1 performs SHUTDOWN IMMEDIATELY, equivalent to a poweroff or crash.
   *       <LI>closemode 0 performs a normal SHUTDOWN that checkpoints the database normally.
   *       <LI>closemode 1 performs a shutdown compact that scripts out the contents of any CACHED
   *           tables to the log then deletes the existing *.data file that contains the data for
   *           all CACHED table before the normal checkpoint process which in turn creates a new,
   *           compact *.data file.
   *     </OL>
   *
   * @return true if closed with no problems or false if a problem was encountered.
   */
  boolean closeLog(int closemode) {

    if (lLog == null) {
      return true;
    }

    try {
      lLog.stop();

      switch (closemode) {
        case Database.CLOSEMODE_IMMEDIATELY:
          lLog.shutdown();
          break;

        case Database.CLOSEMODE_NORMAL:
          lLog.close(false, true);
          break;

        case Database.CLOSEMODE_COMPACT:
        case Database.CLOSEMODE_SCRIPT:
          lLog.close(true, true);
          break;
      }
    } catch (Throwable e) {
      lLog = null;

      return false;
    }

    lLog = null;

    return true;
  }