Example #1
0
  /** Show information from a checkpoint file */
  int infoCheckpoint() {
    // Load checkpoint file
    BdsSerializer bdsSerializer = new BdsSerializer(chekcpointRestoreFile, config);
    List<BdsThread> bdsThreads = bdsSerializer.load();

    for (BdsThread bdsThread : bdsThreads) bdsThread.print();

    return 0;
  }
Example #2
0
  /** Restore from checkpoint and run */
  int runCheckpoint() {
    // Load checkpoint file
    BdsSerializer bdsSerializer = new BdsSerializer(chekcpointRestoreFile, config);
    List<BdsThread> bdsThreads = bdsSerializer.load();

    // Set main thread's programUnit running scope (mostly for debugging and test cases)
    // ProgramUnit's scope it the one before 'global'
    BdsThread mainThread = bdsThreads.get(0);
    programUnit = mainThread.getProgramUnit();

    // Set state and recover tasks
    for (BdsThread bdsThread : bdsThreads) {
      if (bdsThread.isFinished()) {
        // Thread finished before serialization: Nothing to do
      } else {
        bdsThread.setRunState(RunState.CHECKPOINT_RECOVER); // Set run state to recovery
        bdsThread.restoreUnserializedTasks(); // Re-execute or add tasks
      }
    }

    // All set, run main thread
    return runThread(mainThread);
  }