From da731d2bb81666b9c697d9099da632e7dfcdc0f7 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 9 Sep 2014 12:13:21 +0200 Subject: 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. --- src/main/java/com/c2kernel/persistency/RemoteMap.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/c2kernel/persistency/RemoteMap.java') 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 extends TreeMap 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 extends TreeMap 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() { @Override @@ -54,7 +54,7 @@ public class RemoteMap extends TreeMap impl } }); - mSysKey = sysKey; + mItemPath = itemPath; mLocker = locker; // split the path into path/name @@ -88,7 +88,7 @@ public class RemoteMap extends TreeMap impl }; try { - source = Gateway.getProxyManager().getProxy(new ItemPath(sysKey)); + source = Gateway.getProxyManager().getProxy(mItemPath); source.subscribe(new MemberSubscription(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 extends TreeMap 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 extends TreeMap 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 extends TreeMap 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 extends TreeMap 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) { -- cgit v1.2.3