コード例 #1
0
 /**
  * Internally undo recorded changes we did so far.
  *
  * @return whether the state required undo actions
  */
 boolean undoChanges() {
   final State state = stateUpdater.getAndSet(this, State.ROLLBACK_ONLY);
   if (state == State.COMPLETED || state == State.ROLLBACK_ONLY) {
     // Was actually completed already
     return false;
   }
   PatchingTaskContext.Mode currentMode = this.mode;
   mode = PatchingTaskContext.Mode.UNDO;
   final PatchContentLoader loader = PatchContentLoader.create(miscBackup, null, null);
   // Undo changes for the identity
   undoChanges(identityEntry, loader);
   // TODO maybe check if we need to do something for the layers too !?
   if (state == State.INVALIDATE || currentMode == PatchingTaskContext.Mode.ROLLBACK) {
     // For apply the state needs to be invalidate
     // For rollback the files are invalidated as part of the tasks
     final PatchingTaskContext.Mode mode =
         currentMode == PatchingTaskContext.Mode.APPLY
             ? PatchingTaskContext.Mode.ROLLBACK
             : PatchingTaskContext.Mode.APPLY;
     for (final File file : moduleInvalidations) {
       try {
         PatchModuleInvalidationUtils.processFile(file, mode);
       } catch (Exception e) {
         PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
       }
     }
   }
   return true;
 }