summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/LocatorManager.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2012-11-13 10:17:27 +0100
committerBenoit Foucher <benoit@zeroc.com>2012-11-13 10:17:27 +0100
commit99b44d083eeee5583adfe642081a827224fa1309 (patch)
tree46bb3af634cbd5d90b9e5d46099f4e0e85f70ec6 /java/src/IceInternal/LocatorManager.java
parentCosmetic updates to IceGrid Admin connection wizard (diff)
downloadice-99b44d083eeee5583adfe642081a827224fa1309.tar.bz2
ice-99b44d083eeee5583adfe642081a827224fa1309.tar.xz
ice-99b44d083eeee5583adfe642081a827224fa1309.zip
Fixed ICE-4927: fixed proxy encoding to marshal protocol/encoding version instead of encoding it in endpoints
Diffstat (limited to 'java/src/IceInternal/LocatorManager.java')
-rw-r--r--java/src/IceInternal/LocatorManager.java63
1 files changed, 59 insertions, 4 deletions
diff --git a/java/src/IceInternal/LocatorManager.java b/java/src/IceInternal/LocatorManager.java
index 06e36c1cd26..843ee55ebf4 100644
--- a/java/src/IceInternal/LocatorManager.java
+++ b/java/src/IceInternal/LocatorManager.java
@@ -11,6 +11,60 @@ package IceInternal;
public final class LocatorManager
{
+ static private class LocatorKey implements Cloneable
+ {
+ public boolean
+ equals(Object o)
+ {
+ assert(o instanceof LocatorKey);
+ LocatorKey k = (LocatorKey)o;
+ if(!k._id.equals(_id))
+ {
+ return false;
+ }
+ if(!k._encoding.equals(_encoding))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public int
+ hashCode()
+ {
+ int h = 5381;
+ h = IceInternal.HashUtil.hashAdd(h, _id);
+ h = IceInternal.HashUtil.hashAdd(h, _encoding);
+ return h;
+ }
+
+ public java.lang.Object
+ clone()
+ {
+ java.lang.Object o = null;
+ try
+ {
+ o = super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false; // impossible
+ }
+ return o;
+ }
+
+ LocatorKey set(Ice.LocatorPrx locator)
+ {
+ Reference r = ((Ice.ObjectPrxHelperBase)locator).__reference();
+ _id = r.getIdentity();
+ _encoding = r.getEncoding();
+ return this;
+ }
+
+ private Ice.Identity _id;
+ private Ice.EncodingVersion _encoding;
+ }
+
LocatorManager(Ice.Properties properties)
{
_background = properties.getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0;
@@ -58,11 +112,11 @@ public final class LocatorManager
// have only one table per locator (not one per locator
// proxy).
//
- LocatorTable table = _locatorTables.get(locator.ice_getIdentity());
+ LocatorTable table = _locatorTables.get(_lookupKey.set(locator));
if(table == null)
{
table = new LocatorTable();
- _locatorTables.put(locator.ice_getIdentity(), table);
+ _locatorTables.put((LocatorKey)_lookupKey.clone(), table);
}
info = new LocatorInfo(locator, table, _background);
@@ -77,6 +131,7 @@ public final class LocatorManager
private java.util.HashMap<Ice.LocatorPrx, LocatorInfo> _table =
new java.util.HashMap<Ice.LocatorPrx, LocatorInfo>();
- private java.util.HashMap<Ice.Identity, LocatorTable> _locatorTables =
- new java.util.HashMap<Ice.Identity, LocatorTable>();
+ private java.util.HashMap<LocatorKey, LocatorTable> _locatorTables =
+ new java.util.HashMap<LocatorKey, LocatorTable>();
+ private LocatorKey _lookupKey = new LocatorKey(); // A key used for the lookup
}