RedissonWriteLock forceUnlock fixed

pull/337/head
Nikita 9 years ago
parent 062b5b59bc
commit 615eedd580

@ -26,8 +26,6 @@ import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandExecutor;
import org.redisson.core.RLock;
import io.netty.util.concurrent.Future;
/**
* Lock will be removed automatically if client disconnects.
*
@ -112,21 +110,6 @@ public class RedissonWriteLock extends RedissonLock implements RLock {
throw new UnsupportedOperationException();
}
Future<Boolean> forceUnlockAsync() {
cancelExpirationRenewal();
return commandExecutor.evalWriteAsync(getName(), LongCodec.INSTANCE, RedisCommands.EVAL_BOOLEAN,
"if (redis.call('hdel', KEYS[1], ARGV[2]) == 1) then " +
"if (redis.call('hlen', KEYS[1]) == 1) then " +
"redis.call('del', KEYS[1]); " +
"redis.call('publish', KEYS[2], ARGV[1]); " +
"end; " +
"return 1; " +
"else " +
"return 0; " +
"end;",
Arrays.<Object>asList(getName(), getChannelName()), unlockMessage, getLockName());
}
@Override
public boolean isLocked() {
String res = commandExecutor.read(getName(), StringCodec.INSTANCE, RedisCommands.HGET, getName(), "mode");

Loading…
Cancel
Save