|
|
@ -23,8 +23,12 @@ import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.redisson.api.RCountDownLatch;
|
|
|
|
import org.redisson.api.RFuture;
|
|
|
|
import org.redisson.api.RFuture;
|
|
|
|
import org.redisson.api.RLock;
|
|
|
|
import org.redisson.api.RLock;
|
|
|
|
|
|
|
|
import org.redisson.api.RPermitExpirableSemaphore;
|
|
|
|
|
|
|
|
import org.redisson.api.RReadWriteLock;
|
|
|
|
|
|
|
|
import org.redisson.api.RSemaphore;
|
|
|
|
import org.redisson.api.RSet;
|
|
|
|
import org.redisson.api.RSet;
|
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
|
import org.redisson.api.SortOrder;
|
|
|
|
import org.redisson.api.SortOrder;
|
|
|
@ -602,21 +606,51 @@ public class RedissonSet<V> extends RedissonExpirable implements RSet<V>, ScanIt
|
|
|
|
return commandExecutor.writeAsync(getName(), codec, RedisCommands.SORT_TO, params.toArray());
|
|
|
|
return commandExecutor.writeAsync(getName(), codec, RedisCommands.SORT_TO, params.toArray());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getLockName(Object value) {
|
|
|
|
public String getLockName(Object value, String suffix) {
|
|
|
|
ByteBuf state = encode(value);
|
|
|
|
ByteBuf state = encode(value);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return suffixName(getName(value), Hash.hash128toBase64(state) + ":lock");
|
|
|
|
return suffixName(getName(value), Hash.hash128toBase64(state) + ":" + suffix);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
state.release();
|
|
|
|
state.release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public RPermitExpirableSemaphore getPermitExpirableSemaphore(V value) {
|
|
|
|
|
|
|
|
String lockName = getLockName(value, "permitexpirablesemaphore");
|
|
|
|
|
|
|
|
return new RedissonPermitExpirableSemaphore(commandExecutor, lockName, ((Redisson)redisson).getSemaphorePubSub());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public RSemaphore getSemaphore(V value) {
|
|
|
|
|
|
|
|
String lockName = getLockName(value, "semaphore");
|
|
|
|
|
|
|
|
return new RedissonSemaphore(commandExecutor, lockName, ((Redisson)redisson).getSemaphorePubSub());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public RCountDownLatch getCountDownLatch(V value) {
|
|
|
|
|
|
|
|
String lockName = getLockName(value, "countdownlatch");
|
|
|
|
|
|
|
|
return new RedissonCountDownLatch(commandExecutor, lockName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public RLock getFairLock(V value) {
|
|
|
|
|
|
|
|
String lockName = getLockName(value, "fairlock");
|
|
|
|
|
|
|
|
return new RedissonFairLock(commandExecutor, lockName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public RLock getLock(V value) {
|
|
|
|
public RLock getLock(V value) {
|
|
|
|
String lockName = getLockName(value);
|
|
|
|
String lockName = getLockName(value, "lock");
|
|
|
|
return new RedissonLock(commandExecutor, lockName);
|
|
|
|
return new RedissonLock(commandExecutor, lockName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public RReadWriteLock getReadWriteLock(V value) {
|
|
|
|
|
|
|
|
String lockName = getLockName(value, "rw_lock");
|
|
|
|
|
|
|
|
return new RedissonReadWriteLock(commandExecutor, lockName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public RFuture<ListScanResult<Object>> scanIteratorAsync(String name, RedisClient client, long startPos,
|
|
|
|
public RFuture<ListScanResult<Object>> scanIteratorAsync(String name, RedisClient client, long startPos,
|
|
|
|
String pattern, int count) {
|
|
|
|
String pattern, int count) {
|
|
|
|