Skip to content

Commit 87de896

Browse files
authored
RedisLockRegistry stopRenew not thread safe #10446
Closes #10446 Signed-off-by: PiotrDuz <[email protected]> Signed-off-by: PiotrDuz <[email protected]>
1 parent 0a26563 commit 87de896

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisLockRegistry.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,11 @@ protected final boolean renew(long expireAfter) {
598598
return res;
599599
}
600600

601+
/* This method can be called by more than 1 thread, thus we need to make sure that it is safe*/
601602
protected final void stopRenew() {
602-
if (this.renewFuture != null) {
603-
this.renewFuture.cancel(true);
603+
ScheduledFuture<?> renewFutureToCancel = this.renewFuture;
604+
if (renewFutureToCancel != null) {
605+
renewFutureToCancel.cancel(true);
604606
this.renewFuture = null;
605607
}
606608
}

0 commit comments

Comments
 (0)