Use Java text blocks for scripts in code
* Fix `WebServiceInboundGatewayParserTests` for reply timeout for replies which never come accoridn the test logic
This commit is contained in:
@@ -287,16 +287,17 @@ public final class RedisLockRegistry implements ExpirableLockRegistry, Disposabl
|
||||
|
||||
private abstract class RedisLock implements Lock {
|
||||
|
||||
private static final String OBTAIN_LOCK_SCRIPT =
|
||||
"local lockClientId = redis.call('GET', KEYS[1]) " +
|
||||
"if lockClientId == ARGV[1] then " +
|
||||
" redis.call('PEXPIRE', KEYS[1], ARGV[2]) " +
|
||||
" return true " +
|
||||
"elseif not lockClientId then " +
|
||||
" redis.call('SET', KEYS[1], ARGV[1], 'PX', ARGV[2]) " +
|
||||
" return true " +
|
||||
"end " +
|
||||
"return false";
|
||||
private static final String OBTAIN_LOCK_SCRIPT = """
|
||||
local lockClientId = redis.call('GET', KEYS[1])
|
||||
if lockClientId == ARGV[1] then
|
||||
redis.call('PEXPIRE', KEYS[1], ARGV[2])
|
||||
return true
|
||||
elseif not lockClientId then
|
||||
redis.call('SET', KEYS[1], ARGV[1], 'PX', ARGV[2])
|
||||
return true
|
||||
end
|
||||
return false
|
||||
""";
|
||||
|
||||
protected static final RedisScript<Boolean>
|
||||
OBTAIN_LOCK_REDIS_SCRIPT = new DefaultRedisScript<>(OBTAIN_LOCK_SCRIPT, Boolean.class);
|
||||
|
||||
Reference in New Issue
Block a user