|
|
@ -20,9 +20,14 @@ import java.util.concurrent.Semaphore;
|
|
|
|
|
|
|
|
|
|
|
|
import org.redisson.misc.RPromise;
|
|
|
|
import org.redisson.misc.RPromise;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @author Nikita Koksharov
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
public class RedissonLockEntry implements PubSubEntry<RedissonLockEntry> {
|
|
|
|
public class RedissonLockEntry implements PubSubEntry<RedissonLockEntry> {
|
|
|
|
|
|
|
|
|
|
|
|
private int counter;
|
|
|
|
private volatile int counter;
|
|
|
|
|
|
|
|
|
|
|
|
private final Semaphore latch;
|
|
|
|
private final Semaphore latch;
|
|
|
|
private final RPromise<RedissonLockEntry> promise;
|
|
|
|
private final RPromise<RedissonLockEntry> promise;
|
|
|
@ -34,6 +39,10 @@ public class RedissonLockEntry implements PubSubEntry<RedissonLockEntry> {
|
|
|
|
this.promise = promise;
|
|
|
|
this.promise = promise;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int acquired() {
|
|
|
|
|
|
|
|
return counter;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void acquire() {
|
|
|
|
public void acquire() {
|
|
|
|
counter++;
|
|
|
|
counter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|