Пример #1
0
 public synchronized void start() {
   if (isRunning) {
     return;
   }
   // report if checkpoint incomplete/invalid
   if (getRecoveryCheckpoint() != null) {
     File cpDir = getRecoveryCheckpoint().getCheckpointDir().getFile();
     if (!Checkpoint.hasValidStamp(cpDir)) {
       LOGGER.severe(
           "checkpoint '"
               + cpDir.getAbsolutePath()
               + "' missing validity stamp file; checkpoint data "
               + "may be missing or otherwise corrupt.");
     }
   }
   this.isRunning = true;
   setupCheckpointTask();
 }
Пример #2
0
 /**
  * Returns a list of available, valid (contains 'valid' file) checkpoint directories, as File
  * instances, with the more recently-written appearing first.
  *
  * @return List of valid checkpoint directory File instances
  */
 @SuppressWarnings("unchecked")
 public List<File> findAvailableCheckpointDirectories() {
   File[] dirs =
       getCheckpointsDir().getFile().listFiles((FileFilter) FileFilterUtils.directoryFileFilter());
   if (dirs == null) {
     return Collections.EMPTY_LIST;
   }
   Arrays.sort(dirs, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
   LinkedList<File> dirsList = new LinkedList<File>(Arrays.asList(dirs));
   Iterator<File> iter = dirsList.iterator();
   while (iter.hasNext()) {
     File cpDir = iter.next();
     if (!Checkpoint.hasValidStamp(cpDir)) {
       LOGGER.warning("checkpoint '" + cpDir + "' missing validity stamp file; ignoring");
       iter.remove();
     }
   }
   return dirsList;
 }