RedissonLock id moved to Redisson

pull/6/head
Nikita 11 years ago
parent cd83488509
commit 58f0ed0c25

@ -16,6 +16,7 @@
package org.redisson;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@ -56,6 +57,8 @@ public class Redisson {
private final ConnectionManager connectionManager;
private final UUID id = UUID.randomUUID();
public Redisson(Config config) {
connectionManager = new ConnectionManager(config);
}
@ -99,7 +102,7 @@ public class Redisson {
public RLock getLock(String name) {
RedissonLock lock = locksMap.get(name);
if (lock == null) {
lock = new RedissonLock(connectionManager, name);
lock = new RedissonLock(connectionManager, name, id);
RedissonLock oldLock = locksMap.putIfAbsent(name, lock);
if (oldLock != null) {
lock = oldLock;

@ -102,8 +102,7 @@ public class RedissonLock implements RLock {
private final ConnectionManager connectionManager;
// TODO move it to Redisson as ID
private final UUID id = UUID.randomUUID();
private final UUID id;
private final String groupName = "redisson_lock_";
private final String name;
@ -116,9 +115,10 @@ public class RedissonLock implements RLock {
private PubSubEntry pubSubEntry;
RedissonLock(ConnectionManager connectionManager, String name) {
RedissonLock(ConnectionManager connectionManager, String name, UUID id) {
this.connectionManager = connectionManager;
this.name = name;
this.id = id;
}
public void subscribe() {
@ -239,7 +239,6 @@ public class RedissonLock implements RLock {
} finally {
connectionManager.release(connection);
}
}
@Override

@ -15,14 +15,10 @@
*/
package org.redisson.config;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.lambdaworks.redis.codec.JsonJacksonCodec;
import com.lambdaworks.redis.codec.RedisCodec;

Loading…
Cancel
Save