コード例 #1
0
ファイル: RepQuoteExample.java プロジェクト: gildafnai82/craq
  public void run() {
    java.io.File[] logFileList;
    int logs_to_keep = 3;
    int minlog;

    for (; ; ) {
      /*
       * Wait for one minute, polling once per second to see if
       * application has finished.  When application has finished,
       * terminate this thread.
       */
      for (int i = 0; i < 60; i++) {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException ie) {
        }
        if (myEnv.getAppFinished()) return;
      }

      try {
        /* Get the list of unneeded log files. */
        logFileList = myEnv.getArchiveLogFiles(false);
        /*
         * Remove all but the logs_to_keep most recent unneeded
         * log files.
         */
        minlog = logFileList.length - logs_to_keep;
        for (int i = 0; i < minlog; i++) {
          logFileList[i].delete();
        }
      } catch (DatabaseException de) {
        System.err.println("Problem deleting log archive files.");
      }
    }
  }
コード例 #2
0
ファイル: RepQuoteExample.java プロジェクト: gildafnai82/craq
  public void run() {
    for (; ; ) {
      /*
       * Wait for one minute, polling once per second to see if
       * application has finished.  When application has finished,
       * terminate this thread.
       */
      for (int i = 0; i < 60; i++) {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException ie) {
        }
        if (myEnv.getAppFinished()) return;
      }

      /* Perform a checkpoint. */
      try {
        myEnv.checkpoint(null);
      } catch (DatabaseException de) {
        System.err.println("Could not perform checkpoint.");
      }
    }
  }