|
|
|
@ -288,6 +288,9 @@ public class RedissonSemaphore extends RedissonExpirable implements RSemaphore {
|
|
|
|
|
if (permits < 0) {
|
|
|
|
|
throw new IllegalArgumentException("Permits amount can't be negative");
|
|
|
|
|
}
|
|
|
|
|
if (permits == 0) {
|
|
|
|
|
return RedissonPromise.newSucceededFuture(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
|
|
|
|
|
"local value = redis.call('get', KEYS[1]); " +
|
|
|
|
@ -469,6 +472,9 @@ public class RedissonSemaphore extends RedissonExpirable implements RSemaphore {
|
|
|
|
|
if (permits < 0) {
|
|
|
|
|
throw new IllegalArgumentException("Permits amount can't be negative");
|
|
|
|
|
}
|
|
|
|
|
if (permits == 0) {
|
|
|
|
|
return RedissonPromise.newSucceededFuture(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return commandExecutor.evalWriteAsync(getName(), StringCodec.INSTANCE, RedisCommands.EVAL_VOID,
|
|
|
|
|
"local value = redis.call('incrby', KEYS[1], ARGV[1]); " +
|
|
|
|
|