Skip to content

Commit 5625cdd

Browse files
author
Michal Domagala
committed
Drop fallback from Redis unlink to delete
Redis 3, target of fallback, is not maintained since 2018 Signed-off-by: Michal Domagala <[email protected]>
1 parent eb6dead commit 5625cdd

File tree

1 file changed

+7
-32
lines changed

1 file changed

+7
-32
lines changed

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

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747

4848
import org.springframework.beans.factory.DisposableBean;
4949
import org.springframework.dao.CannotAcquireLockException;
50-
import org.springframework.dao.InvalidDataAccessApiUsageException;
51-
import org.springframework.data.redis.RedisSystemException;
5250
import org.springframework.data.redis.connection.Message;
5351
import org.springframework.data.redis.connection.MessageListener;
5452
import org.springframework.data.redis.connection.RedisConnectionFactory;
@@ -160,8 +158,6 @@ protected boolean removeEldestEntry(Entry<String, RedisLock> eldest) {
160158
*/
161159
private boolean executorExplicitlySet;
162160

163-
private volatile boolean unlinkAvailable = true;
164-
165161
private volatile boolean isRunningRedisMessageListenerContainer = false;
166162

167163
/**
@@ -585,34 +581,13 @@ public final void unlock() {
585581
}
586582

587583
private void removeLockKey() {
588-
if (RedisLockRegistry.this.unlinkAvailable) {
589-
try {
590-
boolean unlinkResult = removeLockKeyInnerUnlink();
591-
if (unlinkResult) {
592-
// Lock key successfully unlinked
593-
stopRenew();
594-
} else {
595-
throw new ConcurrentModificationException("Lock was released in the store due to expiration. " +
596-
"The integrity of data protected by this lock may have been compromised.");
597-
}
598-
}
599-
catch (InvalidDataAccessApiUsageException | RedisSystemException ex) {
600-
// Redis 3 or earlier lacks of UNLINK support
601-
// jedis throws InvalidDataAccessApiUsageException, lettuce RedisSystemException
602-
LOGGER.warn("The UNLINK command has failed (not supported on the Redis server?); " +
603-
"falling back to the regular DELETE command", ex);
604-
RedisLockRegistry.this.unlinkAvailable = false;
605-
removeLockKey(); // retry with delete branch
606-
}
607-
} else {
608-
boolean deleteResult = removeLockKeyInnerDelete();
609-
if (deleteResult) {
610-
// Lock key successfully deleted
611-
stopRenew();
612-
} else {
613-
throw new ConcurrentModificationException("Lock was released in the store due to expiration. " +
614-
"The integrity of data protected by this lock may have been compromised.");
615-
}
584+
boolean unlinkResult = removeLockKeyInnerUnlink();
585+
if (unlinkResult) {
586+
// Lock key successfully unlinked
587+
stopRenew();
588+
} else {
589+
throw new ConcurrentModificationException("Lock was released in the store due to expiration. " +
590+
"The integrity of data protected by this lock may have been compromised.");
616591
}
617592
}
618593

0 commit comments

Comments
 (0)