|
|
@ -26,8 +26,6 @@ import org.redisson.client.protocol.RedisCommands;
|
|
|
|
import org.redisson.command.CommandExecutor;
|
|
|
|
import org.redisson.command.CommandExecutor;
|
|
|
|
import org.redisson.core.RLock;
|
|
|
|
import org.redisson.core.RLock;
|
|
|
|
|
|
|
|
|
|
|
|
import io.netty.util.concurrent.Future;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Lock will be removed automatically if client disconnects.
|
|
|
|
* Lock will be removed automatically if client disconnects.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -112,21 +110,6 @@ public class RedissonWriteLock extends RedissonLock implements RLock {
|
|
|
|
throw new UnsupportedOperationException();
|
|
|
|
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
|
|
|
|
@Override
|
|
|
|
public boolean isLocked() {
|
|
|
|
public boolean isLocked() {
|
|
|
|
String res = commandExecutor.read(getName(), StringCodec.INSTANCE, RedisCommands.HGET, getName(), "mode");
|
|
|
|
String res = commandExecutor.read(getName(), StringCodec.INSTANCE, RedisCommands.HGET, getName(), "mode");
|
|
|
|