diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-09-19 05:54:42 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-09-19 05:54:42 +0000 |
commit | a11ea64ba4cc566f1928b5df36d4b8114d57e8f0 (patch) | |
tree | b33f8818a35f03fffdc46963639e4302c66b1e64 /java/src/Ice/ObjectAdapterI.java | |
parent | minor refactoring (diff) | |
download | ice-a11ea64ba4cc566f1928b5df36d4b8114d57e8f0.tar.bz2 ice-a11ea64ba4cc566f1928b5df36d4b8114d57e8f0.tar.xz ice-a11ea64ba4cc566f1928b5df36d4b8114d57e8f0.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=435. added
removeRouter().
Diffstat (limited to 'java/src/Ice/ObjectAdapterI.java')
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index d0e65090264..bd644eddd9b 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -529,11 +529,65 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // router's client proxy to use this object adapter for // callbacks. // - _instance.outgoingConnectionFactory().setRouter(routerInfo.getRouter()); + _instance.outgoingConnectionFactory().setRouterInfo(routerInfo); } } public synchronized void + removeRouter(RouterPrx router) + { + checkForDeactivation(); + + IceInternal.RouterInfo routerInfo = _instance.routerManager().erase(router); + if(routerInfo != null) + { + // + // Rebuild the router endpoints from our set of router infos. + // + _routerEndpoints = new java.util.ArrayList(); + java.util.Iterator p = _routerInfos.iterator(); + while(p.hasNext()) + { + IceInternal.RouterInfo curr = (IceInternal.RouterInfo)p.next(); + if(curr == routerInfo) + { + p.remove(); + continue; + } + ObjectPrxHelperBase proxy = (ObjectPrxHelperBase)routerInfo.getServerProxy(); + IceInternal.EndpointI[] endpoints = proxy.__reference().getEndpoints(); + for(int i = 0; i < endpoints.length; ++i) + { + _routerEndpoints.add(endpoints[i]); + } + } + + java.util.Collections.sort(_routerEndpoints); // Must be sorted. + for(int i = 0; i < _routerEndpoints.size() - 1; ++i) + { + java.lang.Object o1 = _routerEndpoints.get(i); + java.lang.Object o2 = _routerEndpoints.get(i + 1); + if(o1.equals(o2)) + { + _routerEndpoints.remove(i); + } + } + + // + // Clear this object adapter with the router. + // + routerInfo.setAdapter(null); + + // + // Also modify all existing outgoing connections to the + // router's client proxy to use this object adapter for + // callbacks. + // + _instance.outgoingConnectionFactory().setRouterInfo(routerInfo); + } + } + + public synchronized void setLocator(LocatorPrx locator) { checkForDeactivation(); @@ -1000,6 +1054,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt final private String _id; private java.util.ArrayList _incomingConnectionFactories = new java.util.ArrayList(); private java.util.ArrayList _routerEndpoints = new java.util.ArrayList(); + private java.util.ArrayList _routerInfos = new java.util.ArrayList(); private java.util.ArrayList _publishedEndpoints; private IceInternal.LocatorInfo _locatorInfo; private int _directCount; |