execute all lock, semaphore and countdownlatch commands using master node. #545

pull/546/head
Nikita 9 years ago
parent 5f1631810d
commit b71e3dde05

@ -138,7 +138,7 @@ public class RedissonCountDownLatch extends RedissonObject implements RCountDown
@Override
public Future<Long> getCountAsync() {
return commandExecutor.readAsync(getName(), LongCodec.INSTANCE, RedisCommands.GET_LONG, getName());
return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GET_LONG, getName());
}
@Override

@ -391,12 +391,12 @@ public class RedissonLock extends RedissonExpirable implements RLock {
@Override
public boolean isHeldByCurrentThread() {
return commandExecutor.read(getName(), LongCodec.INSTANCE, RedisCommands.HEXISTS, getName(), getLockName(Thread.currentThread().getId()));
return commandExecutor.write(getName(), LongCodec.INSTANCE, RedisCommands.HEXISTS, getName(), getLockName(Thread.currentThread().getId()));
}
@Override
public int getHoldCount() {
Long res = commandExecutor.read(getName(), LongCodec.INSTANCE, RedisCommands.HGET, getName(), getLockName(Thread.currentThread().getId()));
Long res = commandExecutor.write(getName(), LongCodec.INSTANCE, RedisCommands.HGET, getName(), getLockName(Thread.currentThread().getId()));
if (res == null) {
return 0;
}

@ -434,7 +434,7 @@ public class RedissonSemaphore extends RedissonExpirable implements RSemaphore {
@Override
public int availablePermits() {
Long res = commandExecutor.read(getName(), LongCodec.INSTANCE, RedisCommands.GET_LONG, getName());
Long res = commandExecutor.write(getName(), LongCodec.INSTANCE, RedisCommands.GET_LONG, getName());
return res.intValue();
}

Loading…
Cancel
Save