summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/persistency/RemoteMap.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-09-09 12:13:21 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-09-09 12:13:21 +0200
commitda731d2bb81666b9c697d9099da632e7dfcdc0f7 (patch)
tree567693c3c48f3d15ecbb2dac4f9db03bb6e58c72 /src/main/java/com/c2kernel/persistency/RemoteMap.java
parentae1e79e33fd30e3d8bcedbef8891a14a048276d7 (diff)
Replaced int sysKey Item identifier with UUID, which is now portable.
ItemPath objects are now used to identify Items throughout the kernel, replacing ints and Integers.
Diffstat (limited to 'src/main/java/com/c2kernel/persistency/RemoteMap.java')
-rw-r--r--src/main/java/com/c2kernel/persistency/RemoteMap.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/com/c2kernel/persistency/RemoteMap.java b/src/main/java/com/c2kernel/persistency/RemoteMap.java
index 9f1d8a3..48ed220 100644
--- a/src/main/java/com/c2kernel/persistency/RemoteMap.java
+++ b/src/main/java/com/c2kernel/persistency/RemoteMap.java
@@ -30,7 +30,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl
private int mID=-1;
private String mName;
- protected int mSysKey;
+ protected ItemPath mItemPath;
private String mPath = "";
Object keyLock = null;
TransactionManager storage;
@@ -39,7 +39,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl
ItemProxy source;
Object mLocker; // if this remote map will participate in a transaction
- public RemoteMap(int sysKey, String path, Object locker) {
+ public RemoteMap(ItemPath itemPath, String path, Object locker) {
super(new Comparator<String>() {
@Override
@@ -54,7 +54,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl
}
});
- mSysKey = sysKey;
+ mItemPath = itemPath;
mLocker = locker;
// split the path into path/name
@@ -88,7 +88,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl
};
try {
- source = Gateway.getProxyManager().getProxy(new ItemPath(sysKey));
+ source = Gateway.getProxyManager().getProxy(mItemPath);
source.subscribe(new MemberSubscription<V>(listener, path, false));
} catch (Exception ex) {
Logger.error("Error subscribing to remote map. Changes will not be received");
@@ -103,7 +103,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl
synchronized(this) {
String[] keys;
try {
- keys = storage.getClusterContents(mSysKey, mPath+mName);
+ keys = storage.getClusterContents(mItemPath, mPath+mName);
for (String key : keys) super.put(key, null);
} catch (ClusterStorageException e) {
Logger.error(e);
@@ -198,7 +198,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl
try {
V value = super.get(key);
if (value == null) {
- value = (V)storage.get(mSysKey, mPath+mName+"/"+key, mLocker);
+ value = (V)storage.get(mItemPath, mPath+mName+"/"+key, mLocker);
super.put(key, value);
}
return value;
@@ -238,7 +238,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl
public synchronized V put(String key, V value) {
try {
synchronized(this) {
- storage.put(mSysKey, value, mLocker);
+ storage.put(mItemPath, value, mLocker);
return putLocal(key, value);
}
} catch (ClusterStorageException e) {
@@ -259,7 +259,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl
loadKeys();
if (containsKey(key)) try {
synchronized(keyLock) {
- storage.remove(mSysKey, mPath+mName+"/"+key, mLocker);
+ storage.remove(mItemPath, mPath+mName+"/"+key, mLocker);
return super.remove(key);
}
} catch (ClusterStorageException e) {