/** * Cancel any checkpoint that's currently being made, * and prevent any new checkpoints from starting for the next * minute or so. */ public void cancelAndPreventCheckpoints(String msg) throws ServiceFailedException { synchronized (cancelLock) { // The checkpointer thread takes this lock and checks if checkpointing is // postponed. thread.preventCheckpointsFor(PREVENT_AFTER_CANCEL_MS); // Before beginning a checkpoint, the checkpointer thread // takes this lock, and creates a canceler object. // If the canceler is non-null, then a checkpoint is in // progress and we need to cancel it. If it's null, then // the operation has not started, meaning that the above // time-based prevention will take effect. if (canceler != null) { canceler.cancel(msg); } } }
/** * Cancel any checkpoint that's currently being made, * and prevent any new checkpoints from starting for the next * minute or so. */ public void cancelAndPreventCheckpoints(String msg) throws ServiceFailedException { synchronized (cancelLock) { // The checkpointer thread takes this lock and checks if checkpointing is // postponed. thread.preventCheckpointsFor(PREVENT_AFTER_CANCEL_MS); // Before beginning a checkpoint, the checkpointer thread // takes this lock, and creates a canceler object. // If the canceler is non-null, then a checkpoint is in // progress and we need to cancel it. If it's null, then // the operation has not started, meaning that the above // time-based prevention will take effect. if (canceler != null) { canceler.cancel(msg); } } }
/** * Cancel any checkpoint that's currently being made, * and prevent any new checkpoints from starting for the next * minute or so. */ public void cancelAndPreventCheckpoints(String msg) throws ServiceFailedException { synchronized (cancelLock) { // The checkpointer thread takes this lock and checks if checkpointing is // postponed. thread.preventCheckpointsFor(PREVENT_AFTER_CANCEL_MS); // Before beginning a checkpoint, the checkpointer thread // takes this lock, and creates a canceler object. // If the canceler is non-null, then a checkpoint is in // progress and we need to cancel it. If it's null, then // the operation has not started, meaning that the above // time-based prevention will take effect. if (canceler != null) { canceler.cancel(msg); } } }
@Override public Void call() throws Exception { canceler.cancel("cancelled"); return null; } });