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:
abilan
2023-03-28 18:50:34 -04:00
parent 775e6fdac5
commit 22d47e72e9
6 changed files with 226 additions and 111 deletions

View File

@@ -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);