diff options
author | Mark Spruiell <mes@zeroc.com> | 2006-03-10 21:20:29 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2006-03-10 21:20:29 +0000 |
commit | 051caa3a84bb291f9c56724eb1d3f0ab8aac5d85 (patch) | |
tree | 8b63427975db549c7d770cdb37a81a97ec4854fc /java/src | |
parent | separate routing tables (diff) | |
download | ice-051caa3a84bb291f9c56724eb1d3f0ab8aac5d85.tar.bz2 ice-051caa3a84bb291f9c56724eb1d3f0ab8aac5d85.tar.xz ice-051caa3a84bb291f9c56724eb1d3f0ab8aac5d85.zip |
bug 540
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceInternal/RouterInfo.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/RoutingTable.java | 59 |
2 files changed, 61 insertions, 2 deletions
diff --git a/java/src/IceInternal/RouterInfo.java b/java/src/IceInternal/RouterInfo.java index a83ccbc78f8..7a07f054e38 100644 --- a/java/src/IceInternal/RouterInfo.java +++ b/java/src/IceInternal/RouterInfo.java @@ -14,7 +14,7 @@ public final class RouterInfo RouterInfo(Ice.RouterPrx router) { _router = router; - _routingTable = new Ice.RoutingTable(); + _routingTable = new RoutingTable(); assert(_router != null); } @@ -141,6 +141,6 @@ public final class RouterInfo private final Ice.RouterPrx _router; private Ice.ObjectPrx _clientProxy; private Ice.ObjectPrx _serverProxy; - private final Ice.RoutingTable _routingTable; + private final RoutingTable _routingTable; private Ice.ObjectAdapter _adapter; } diff --git a/java/src/IceInternal/RoutingTable.java b/java/src/IceInternal/RoutingTable.java new file mode 100644 index 00000000000..647c4f7f852 --- /dev/null +++ b/java/src/IceInternal/RoutingTable.java @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package IceInternal; + +public final class RoutingTable +{ + public + RoutingTable() + { + } + + // + // Clear the contents of the routing table. + // + synchronized public void + clear() + { + _table.clear(); + } + + // + // Returns false if the Proxy exists already. + // + public boolean + add(Ice.ObjectPrx prx) + { + if(prx == null) + { + return false; + } + + // + // We insert the proxy in its default form into the routing table. + // + Ice.ObjectPrx proxy = prx.ice_twoway().ice_secure(false); + + synchronized(this) + { + if(!_table.containsKey(proxy.ice_getIdentity())) + { + _table.put(proxy.ice_getIdentity(), proxy); + return true; + } + else + { + return false; + } + } + } + + private java.util.HashMap _table = new java.util.HashMap(); +} |