diff --git a/src/com/serotonin/timer/TimerTask.java b/src/com/serotonin/timer/TimerTask.java index f48e78f738..f5f6c9620a 100644 --- a/src/com/serotonin/timer/TimerTask.java +++ b/src/com/serotonin/timer/TimerTask.java @@ -88,8 +88,8 @@ public boolean cancel() { boolean result = (state == SCHEDULED); if (completeBeforeCancel) { + cancelLock.writeLock().lock(); try { - cancelLock.writeLock().lock(); state = CANCELLED; } finally {