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 @Override
public Future<Long> getCountAsync() { 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 @Override

@ -391,12 +391,12 @@ public class RedissonLock extends RedissonExpirable implements RLock {
@Override @Override
public boolean isHeldByCurrentThread() { 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 @Override
public int getHoldCount() { 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) { if (res == null) {
return 0; return 0;
} }

@ -434,7 +434,7 @@ public class RedissonSemaphore extends RedissonExpirable implements RSemaphore {
@Override @Override
public int availablePermits() { 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(); return res.intValue();
} }

Loading…
Cancel
Save