|
47 | 47 |
|
48 | 48 | import org.springframework.beans.factory.DisposableBean; |
49 | 49 | import org.springframework.dao.CannotAcquireLockException; |
50 | | -import org.springframework.dao.InvalidDataAccessApiUsageException; |
51 | | -import org.springframework.data.redis.RedisSystemException; |
52 | 50 | import org.springframework.data.redis.connection.Message; |
53 | 51 | import org.springframework.data.redis.connection.MessageListener; |
54 | 52 | import org.springframework.data.redis.connection.RedisConnectionFactory; |
@@ -160,8 +158,6 @@ protected boolean removeEldestEntry(Entry<String, RedisLock> eldest) { |
160 | 158 | */ |
161 | 159 | private boolean executorExplicitlySet; |
162 | 160 |
|
163 | | - private volatile boolean unlinkAvailable = true; |
164 | | - |
165 | 161 | private volatile boolean isRunningRedisMessageListenerContainer = false; |
166 | 162 |
|
167 | 163 | /** |
@@ -585,34 +581,13 @@ public final void unlock() { |
585 | 581 | } |
586 | 582 |
|
587 | 583 | 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."); |
616 | 591 | } |
617 | 592 | } |
618 | 593 |
|
|
0 commit comments