Skip to content

Commit

Permalink
WFLY-11590 Cancelled timer not removed from internal cache when using…
Browse files Browse the repository at this point in the history
… persistent timers
  • Loading branch information
jbaesner committed Jan 21, 2019
1 parent bb04653 commit 1447201
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -645,7 +645,7 @@ public void cancelTimer(final TimerImpl timer) throws InterruptedException {
// cancel any scheduled Future for this timer
this.cancelTimeout(timer);
this.unregisterTimerResource(timer.getId());
this.timers.remove(timer.getId());
removeTimerFromInternalCache(timer);
}
// persist changes
persistTimer(timer, false);
Expand All @@ -660,7 +660,7 @@ public void expireTimer(final TimerImpl timer) {
this.cancelTimeout(timer);
timer.setTimerState(TimerState.EXPIRED, null);
this.unregisterTimerResource(timer.getId());
this.timers.remove(timer.getId());
removeTimerFromInternalCache(timer);
}

/**
Expand Down Expand Up @@ -925,6 +925,11 @@ protected void cancelTimeout(final TimerImpl timer) {
}
}

private void removeTimerFromInternalCache(final TimerImpl timer) {
timers.remove(timer.getId());
EJB3_TIMER_LOGGER.debugv("Removed timer {0} from internal cache", timer);
}

public boolean isScheduled(final String tid){
synchronized (this.scheduledTimerFutures) {
return this.scheduledTimerFutures.containsKey(tid);
Expand Down Expand Up @@ -1205,7 +1210,7 @@ public void afterCompletion(final int status) {
if (status == Status.STATUS_COMMITTED) {
cancelTimeout(timer);
unregisterTimerResource(timer.getId());
timers.remove(timer.getId());
removeTimerFromInternalCache(timer);
} else {
timer.setTimerState(TimerState.ACTIVE, null);
}
Expand Down Expand Up @@ -1322,6 +1327,7 @@ public void timerRemoved(String timerId) {
TimerImpl timer = TimerServiceImpl.this.getTimer(timerId);
if(timer != null) {
TimerServiceImpl.this.cancelTimeout(timer);
TimerServiceImpl.this.removeTimerFromInternalCache(timer);
}
}

Expand Down

0 comments on commit 1447201

Please sign in to comment.