diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2007-01-03 18:08:31 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2007-01-03 18:08:31 +0000 |
commit | ae899e981811eec7ad4ee2c7bf354174cf7dfeaf (patch) | |
tree | 8606155063f77cf50d0d28e335c544bd776b603a | |
parent | Added -bind_at_load, without this we get various crashes in the linker (diff) | |
download | ice-ae899e981811eec7ad4ee2c7bf354174cf7dfeaf.tar.bz2 ice-ae899e981811eec7ad4ee2c7bf354174cf7dfeaf.tar.xz ice-ae899e981811eec7ad4ee2c7bf354174cf7dfeaf.zip |
Bug 1327 - allow getClientProxy to return nil proxy
-rw-r--r-- | cpp/CHANGES | 5 | ||||
-rw-r--r-- | cpp/config/PropertyNames.def | 1 | ||||
-rw-r--r-- | cpp/src/Glacier2/RouterI.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/RouterInfo.cpp | 99 | ||||
-rw-r--r-- | cpp/src/Ice/RouterInfo.h | 11 | ||||
-rw-r--r-- | cs/src/Ice/ConnectionFactory.cs | 3 | ||||
-rwxr-xr-x | cs/src/Ice/ObjectAdapterI.cs | 3 | ||||
-rw-r--r-- | cs/src/Ice/PropertyNames.cs | 3 | ||||
-rwxr-xr-x | cs/src/Ice/Reference.cs | 3 | ||||
-rwxr-xr-x | cs/src/Ice/RouterInfo.cs | 95 | ||||
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 3 | ||||
-rw-r--r-- | java/src/IceInternal/OutgoingConnectionFactory.java | 3 | ||||
-rw-r--r-- | java/src/IceInternal/PropertyNames.java | 3 | ||||
-rw-r--r-- | java/src/IceInternal/RoutableReference.java | 3 | ||||
-rw-r--r-- | java/src/IceInternal/RouterInfo.java | 98 |
20 files changed, 155 insertions, 203 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 80240b36b6e..d15ad6b25ad 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,11 @@ Changes since version 3.1.1 --------------------------- +- Added new property, Glacier2.ReturnClientProxy to control whether + the Glacier2 Router::getClientProxy() returns a proxy or just null. By + default this property is set to 0. If Glacier2 is being used by clients + older than version 3.2, then this property must be set to 1. + - Added support for a user callback when SIGINT like signals are sent to applications that use the Application interface. See Application::interruptCallback and Application::userCallbackOnInterrupt diff --git a/cpp/config/PropertyNames.def b/cpp/config/PropertyNames.def index 7bf928b72c9..05e3b8a942e 100644 --- a/cpp/config/PropertyNames.def +++ b/cpp/config/PropertyNames.def @@ -439,6 +439,7 @@ Glacier2: PermissionsVerifier.Locator PermissionsVerifier.Router PermissionsVerifier.CollocationOptimization + ReturnClientProxy SSLPermissionsVerifier SSLPermissionsVerifier.EndpointSelection SSLPermissionsVerifier.ConnectionCached diff --git a/cpp/src/Glacier2/RouterI.cpp b/cpp/src/Glacier2/RouterI.cpp index dadef55b63b..af1275bd627 100644 --- a/cpp/src/Glacier2/RouterI.cpp +++ b/cpp/src/Glacier2/RouterI.cpp @@ -23,7 +23,6 @@ Glacier2::RouterI::RouterI(const ObjectAdapterPtr& clientAdapter, const ObjectAd const string& userId, const SessionPrx& session, const Identity& controlId, const FilterManagerPtr& filters, const Ice::Context& sslContext) : _communicator(clientAdapter->getCommunicator()), - _clientProxy(clientAdapter->createProxy(_communicator->stringToIdentity("dummy"))), _clientBlobject(new ClientBlobject(_communicator, filters, sslContext)), _adminAdapter(adminAdapter), _connection(connection), @@ -33,6 +32,16 @@ Glacier2::RouterI::RouterI(const ObjectAdapterPtr& clientAdapter, const ObjectAd _sslContext(sslContext), _timestamp(IceUtil::Time::now()) { + // + // If Glacier2 will be used with pre 3.2 clients, then the client proxy must be set. + // Otherwise getClientProxy just needs to return a nil proxy. + // + if(_communicator->getProperties()->getPropertyAsInt("Glacier2.ReturnClientProxy") > 0) + { + const_cast<Ice::ObjectPrx&>(_clientProxy) = + clientAdapter->createProxy(_communicator->stringToIdentity("dummy")); + } + if(serverAdapter) { ObjectPrx& serverProxy = const_cast<ObjectPrx&>(_serverProxy); diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 55a01678fd9..1bae93eddb9 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -390,9 +390,8 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route // callbacks from the router can be received over such // connections. // - ObjectPrx proxy = routerInfo->getClientProxy(); ObjectAdapterPtr adapter = routerInfo->getAdapter(); - vector<EndpointIPtr> endpoints = proxy->__reference()->getEndpoints(); + vector<EndpointIPtr> endpoints = routerInfo->getClientEndpoints(); vector<EndpointIPtr>::const_iterator p; for(p = endpoints.begin(); p != endpoints.end(); ++p) { diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 954e3976ad5..774bb1a45cc 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -766,8 +766,7 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica // Add the router's server proxy endpoints to this object // adapter. // - ObjectPrx proxy = _routerInfo->getServerProxy(); - vector<EndpointIPtr> endpoints = proxy->__reference()->getEndpoints(); + vector<EndpointIPtr> endpoints = _routerInfo->getServerEndpoints(); copy(endpoints.begin(), endpoints.end(), back_inserter(_routerEndpoints)); sort(_routerEndpoints.begin(), _routerEndpoints.end()); // Must be sorted. _routerEndpoints.erase(unique(_routerEndpoints.begin(), _routerEndpoints.end()), diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index 37e79d028e0..58ad2855937 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Fri Dec 22 00:37:02 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Jan 3 13:36:27 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -362,6 +362,7 @@ const char* IceInternal::PropertyNames::Glacier2Props[] = "Glacier2.PermissionsVerifier.Locator", "Glacier2.PermissionsVerifier.Router", "Glacier2.PermissionsVerifier.CollocationOptimization", + "Glacier2.ReturnClientProxy", "Glacier2.SSLPermissionsVerifier", "Glacier2.SSLPermissionsVerifier.EndpointSelection", "Glacier2.SSLPermissionsVerifier.ConnectionCached", diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 6ec5187aba3..0b666cdbe0b 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Fri Dec 22 00:37:02 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Jan 3 13:36:27 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 53307f531b8..61e0c1d44e2 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -735,8 +735,7 @@ IceInternal::RoutableReference::getRoutedEndpoints() const // If we route, we send everything to the router's client // proxy endpoints. // - ObjectPrx clientProxy = _routerInfo->getClientProxy(); - return clientProxy->__reference()->getEndpoints(); + return _routerInfo->getClientEndpoints(); } return vector<EndpointIPtr>(); } diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index 9347ff82c09..33e59a2f218 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -12,6 +12,7 @@ #include <Ice/LocalException.h> #include <Ice/Connection.h> // For ice_connection()->timeout(). #include <Ice/Functional.h> +#include <Ice/Reference.h> using namespace std; using namespace Ice; @@ -120,8 +121,8 @@ IceInternal::RouterInfo::destroy() { IceUtil::Mutex::Lock sync(*this); - _clientProxy = 0; - _serverProxy = 0; + _clientEndpoints.clear(); + _serverEndpoints.clear(); _adapter = 0; _identities.clear(); } @@ -153,85 +154,65 @@ IceInternal::RouterInfo::getRouter() const return _router; } -ObjectPrx -IceInternal::RouterInfo::getClientProxy() +vector<EndpointIPtr> +IceInternal::RouterInfo::getClientEndpoints() { IceUtil::Mutex::Lock sync(*this); - if(!_clientProxy) // Lazy initialization. + if(_clientEndpoints.size() == 0) // Lazy initialization. { - _clientProxy = _router->getClientProxy(); - if(!_clientProxy) + ObjectPrx clientProxy = _router->getClientProxy(); + if(!clientProxy) { - throw NoEndpointException(__FILE__, __LINE__); - } - - _clientProxy = _clientProxy->ice_router(0); // The client proxy cannot be routed. - - // - // In order to avoid creating a new connection to the router, - // we must use the same timeout as the already existing - // connection. - // - try - { - _clientProxy = _clientProxy->ice_timeout(_router->ice_getConnection()->timeout()); + // + // If getClientProxy() return nil, use router endpoints. + // + _clientEndpoints = _router->__reference()->getEndpoints(); } - catch(const Ice::CollocationOptimizationException&) + else { - // Ignore - collocated router + clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed. + + // + // In order to avoid creating a new connection to the router, + // we must use the same timeout as the already existing + // connection. + // + try + { + clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout()); + } + catch(const Ice::CollocationOptimizationException&) + { + // Ignore - collocated router + } + + _clientEndpoints = clientProxy->__reference()->getEndpoints(); } } - return _clientProxy; + return _clientEndpoints; } -void -IceInternal::RouterInfo::setClientProxy(const ObjectPrx& clientProxy) -{ - IceUtil::Mutex::Lock sync(*this); - - _clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed. - - // - // In order to avoid creating a new connection to the router, we - // must use the same timeout as the already existing connection. - // - try - { - _clientProxy = _clientProxy->ice_timeout(_router->ice_getConnection()->timeout()); - } - catch(const Ice::CollocationOptimizationException&) - { - // Ignore - collocated router - } -} - -ObjectPrx -IceInternal::RouterInfo::getServerProxy() +vector<EndpointIPtr> +IceInternal::RouterInfo::getServerEndpoints() { IceUtil::Mutex::Lock sync(*this); - if(!_serverProxy) // Lazy initialization. + if(_serverEndpoints.size() == 0) // Lazy initialization. { - _serverProxy = _router->getServerProxy(); - if(!_serverProxy) + ObjectPrx serverProxy = _router->getServerProxy(); + if(!serverProxy) { throw NoEndpointException(__FILE__, __LINE__); } - _serverProxy = _serverProxy->ice_router(0); // The server proxy cannot be routed. + serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed. + + _serverEndpoints = serverProxy->__reference()->getEndpoints(); } - return _serverProxy; -} - -void -IceInternal::RouterInfo::setServerProxy(const ObjectPrx& serverProxy) -{ - IceUtil::Mutex::Lock sync(*this); - - _serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed. + return _serverEndpoints; } void diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h index 71d885cb394..32dacb0750a 100644 --- a/cpp/src/Ice/RouterInfo.h +++ b/cpp/src/Ice/RouterInfo.h @@ -15,6 +15,7 @@ #include <Ice/RouterInfoF.h> #include <Ice/RouterF.h> #include <Ice/ProxyF.h> +#include <Ice/EndpointIF.h> #include <set> @@ -55,10 +56,8 @@ public: bool operator<(const RouterInfo&) const; Ice::RouterPrx getRouter() const; - Ice::ObjectPrx getClientProxy(); - void setClientProxy(const Ice::ObjectPrx&); - Ice::ObjectPrx getServerProxy(); - void setServerProxy(const Ice::ObjectPrx&); + std::vector<IceInternal::EndpointIPtr> getClientEndpoints(); + std::vector<IceInternal::EndpointIPtr> getServerEndpoints(); void addProxy(const Ice::ObjectPrx&); void setAdapter(const Ice::ObjectAdapterPtr&); Ice::ObjectAdapterPtr getAdapter() const; @@ -66,8 +65,8 @@ public: private: const Ice::RouterPrx _router; - Ice::ObjectPrx _clientProxy; - Ice::ObjectPrx _serverProxy; + std::vector<IceInternal::EndpointIPtr> _clientEndpoints; + std::vector<IceInternal::EndpointIPtr> _serverEndpoints; Ice::ObjectAdapterPtr _adapter; std::set<Ice::Identity> _identities; }; diff --git a/cs/src/Ice/ConnectionFactory.cs b/cs/src/Ice/ConnectionFactory.cs index 258590cb27c..7302c203eb1 100644 --- a/cs/src/Ice/ConnectionFactory.cs +++ b/cs/src/Ice/ConnectionFactory.cs @@ -395,10 +395,9 @@ namespace IceInternal // connections, so that callbacks from the router can be // received over such connections. // - Ice.ObjectPrx proxy = routerInfo.getClientProxy(); Ice.ObjectAdapter adapter = routerInfo.getAdapter(); DefaultsAndOverrides defaultsAndOverrides = instance_.defaultsAndOverrides(); - EndpointI[] endpoints = ((Ice.ObjectPrxHelperBase)proxy).reference__().getEndpoints(); + EndpointI[] endpoints = routerInfo.getClientEndpoints(); for(int i = 0; i < endpoints.Length; i++) { EndpointI endpoint = endpoints[i]; diff --git a/cs/src/Ice/ObjectAdapterI.cs b/cs/src/Ice/ObjectAdapterI.cs index bcceef188da..bdc4491dd08 100755 --- a/cs/src/Ice/ObjectAdapterI.cs +++ b/cs/src/Ice/ObjectAdapterI.cs @@ -786,8 +786,7 @@ namespace Ice // Add the router's server proxy endpoints to this object // adapter. // - ObjectPrxHelperBase proxy = (ObjectPrxHelperBase)_routerInfo.getServerProxy(); - IceInternal.EndpointI[] endpoints = proxy.reference__().getEndpoints(); + IceInternal.EndpointI[] endpoints = _routerInfo.getServerEndpoints(); for(int i = 0; i < endpoints.Length; ++i) { _routerEndpoints.Add(endpoints[i]); diff --git a/cs/src/Ice/PropertyNames.cs b/cs/src/Ice/PropertyNames.cs index 3f31cdadebb..6799bca6278 100644 --- a/cs/src/Ice/PropertyNames.cs +++ b/cs/src/Ice/PropertyNames.cs @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Fri Dec 22 00:37:02 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Jan 3 13:36:27 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -364,6 +364,7 @@ namespace IceInternal @"^Glacier2\.PermissionsVerifier\.Locator$", @"^Glacier2\.PermissionsVerifier\.Router$", @"^Glacier2\.PermissionsVerifier\.CollocationOptimization$", + @"^Glacier2\.ReturnClientProxy$", @"^Glacier2\.SSLPermissionsVerifier$", @"^Glacier2\.SSLPermissionsVerifier\.EndpointSelection$", @"^Glacier2\.SSLPermissionsVerifier\.ConnectionCached$", diff --git a/cs/src/Ice/Reference.cs b/cs/src/Ice/Reference.cs index ce34c9c4086..7f2e74f1815 100755 --- a/cs/src/Ice/Reference.cs +++ b/cs/src/Ice/Reference.cs @@ -736,8 +736,7 @@ namespace IceInternal // If we route, we send everything to the router's client // proxy endpoints. // - Ice.ObjectPrx clientProxy = _routerInfo.getClientProxy(); - return ((Ice.ObjectPrxHelperBase)clientProxy).reference__().getEndpoints(); + return _routerInfo.getClientEndpoints(); } return new EndpointI[0]; } diff --git a/cs/src/Ice/RouterInfo.cs b/cs/src/Ice/RouterInfo.cs index 1b299619a79..89d77af70dc 100755 --- a/cs/src/Ice/RouterInfo.cs +++ b/cs/src/Ice/RouterInfo.cs @@ -27,8 +27,8 @@ namespace IceInternal { lock(this) { - _clientProxy = null; - _serverProxy = null; + _clientEndpoints = new EndpointI[0]; + _serverEndpoints = new EndpointI[0]; _adapter = null; _identities.Clear(); } @@ -58,80 +58,61 @@ namespace IceInternal return _router; } - public Ice.ObjectPrx getClientProxy() + public EndpointI[] getClientEndpoints() { lock(this) { - if(_clientProxy == null) // Lazy initialization. + if(_clientEndpoints == null) // Lazy initialization. { - _clientProxy = _router.getClientProxy(); - if(_clientProxy == null) + Ice.ObjectPrx clientProxy = _router.getClientProxy(); + if(clientProxy == null) { - throw new Ice.NoEndpointException(); + // + // Use router endpoints if getClientProxy returns nil. + // + _clientEndpoints = ((Ice.ObjectPrxHelperBase)_router).reference__().getEndpoints(); } - - _clientProxy = _clientProxy.ice_router(null); // The client proxy cannot be routed. - - // - // In order to avoid creating a new connection to - // the router, we must use the same timeout as the - // already existing connection. - // - try - { - _clientProxy = _clientProxy.ice_timeout(_router.ice_getConnection().timeout()); - } - catch(Ice.CollocationOptimizationException) + else { - // Ignore - collocated router. + clientProxy = clientProxy.ice_router(null); // The client proxy cannot be routed. + + // + // In order to avoid creating a new connection to + // the router, we must use the same timeout as the + // already existing connection. + // + try + { + clientProxy = clientProxy.ice_timeout(_router.ice_getConnection().timeout()); + } + catch(Ice.CollocationOptimizationException) + { + // Ignore - collocated router. + } + + _clientEndpoints = ((Ice.ObjectPrxHelperBase)clientProxy).reference__().getEndpoints(); } } - return _clientProxy; + return _clientEndpoints; } } - public void setClientProxy(Ice.ObjectPrx clientProxy) + public EndpointI[] getServerEndpoints() { - lock(this) + if(_serverEndpoints == null) // Lazy initialization. { - _clientProxy = clientProxy.ice_router(null); // The client proxy cannot be routed. - - // - // In order to avoid creating a new connection to the - // router, we must use the same timeout as the already - // existing connection. - // - try - { - _clientProxy = _clientProxy.ice_timeout(_router.ice_getConnection().timeout()); - } - catch(Ice.CollocationOptimizationException) - { - // Ignore - collocated router. - } - } - } - - public Ice.ObjectPrx getServerProxy() - { - if(_serverProxy == null) // Lazy initialization. - { - _serverProxy = _router.getServerProxy(); - if(_serverProxy == null) + Ice.ObjectPrx serverProxy = _router.getServerProxy(); + if(serverProxy == null) { throw new Ice.NoEndpointException(); } - _serverProxy = _serverProxy.ice_router(null); // The server proxy cannot be routed. + serverProxy = serverProxy.ice_router(null); // The server proxy cannot be routed. + _serverEndpoints = ((Ice.ObjectPrxHelperBase)serverProxy).reference__().getEndpoints(); } - return _serverProxy; - } - - public void setServerProxy(Ice.ObjectPrx serverProxy) - { - _serverProxy = serverProxy.ice_router(null); // The server proxy cannot be routed. + return _serverEndpoints; } public void addProxy(Ice.ObjectPrx proxy) @@ -182,8 +163,8 @@ namespace IceInternal } private readonly Ice.RouterPrx _router; - private Ice.ObjectPrx _clientProxy; - private Ice.ObjectPrx _serverProxy; + private EndpointI[] _clientEndpoints; + private EndpointI[] _serverEndpoints; private IceUtil.Set _identities = new IceUtil.Set(); private Ice.ObjectAdapter _adapter; } diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index c016a5533a0..f72fc0dee2c 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -776,8 +776,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // Add the router's server proxy endpoints to this object // adapter. // - ObjectPrxHelperBase proxy = (ObjectPrxHelperBase)_routerInfo.getServerProxy(); - IceInternal.EndpointI[] endpoints = proxy.__reference().getEndpoints(); + IceInternal.EndpointI[] endpoints = _routerInfo.getServerEndpoints(); for(int i = 0; i < endpoints.length; ++i) { _routerEndpoints.add(endpoints[i]); diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java index 388c2b71027..77646bbce7c 100644 --- a/java/src/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/IceInternal/OutgoingConnectionFactory.java @@ -413,10 +413,9 @@ public final class OutgoingConnectionFactory // connections, so that callbacks from the router can be // received over such connections. // - Ice.ObjectPrx proxy = routerInfo.getClientProxy(); Ice.ObjectAdapter adapter = routerInfo.getAdapter(); DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - EndpointI[] endpoints = ((Ice.ObjectPrxHelperBase)proxy).__reference().getEndpoints(); + EndpointI[] endpoints = routerInfo.getClientEndpoints(); for(int i = 0; i < endpoints.length; i++) { EndpointI endpoint = endpoints[i]; diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java index f8a3a16e1a3..17e0dc87779 100644 --- a/java/src/IceInternal/PropertyNames.java +++ b/java/src/IceInternal/PropertyNames.java @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Fri Dec 22 00:37:02 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Jan 3 13:36:27 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -364,6 +364,7 @@ public final class PropertyNames "^Glacier2\\.PermissionsVerifier\\.Locator$", "^Glacier2\\.PermissionsVerifier\\.Router$", "^Glacier2\\.PermissionsVerifier\\.CollocationOptimization$", + "^Glacier2\\.ReturnClientProxy$", "^Glacier2\\.SSLPermissionsVerifier$", "^Glacier2\\.SSLPermissionsVerifier\\.EndpointSelection$", "^Glacier2\\.SSLPermissionsVerifier\\.ConnectionCached$", diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java index 7a288999748..7a1b2c9132e 100644 --- a/java/src/IceInternal/RoutableReference.java +++ b/java/src/IceInternal/RoutableReference.java @@ -26,8 +26,7 @@ public abstract class RoutableReference extends Reference // If we route, we send everything to the router's client // proxy endpoints. // - Ice.ObjectPrx clientProxy = _routerInfo.getClientProxy(); - return ((Ice.ObjectPrxHelperBase)clientProxy).__reference().getEndpoints(); + return _routerInfo.getClientEndpoints(); } return new EndpointI[0]; } diff --git a/java/src/IceInternal/RouterInfo.java b/java/src/IceInternal/RouterInfo.java index 36f61c5956d..8a1372870fe 100644 --- a/java/src/IceInternal/RouterInfo.java +++ b/java/src/IceInternal/RouterInfo.java @@ -21,8 +21,8 @@ public final class RouterInfo synchronized public void destroy() { - _clientProxy = null; - _serverProxy = null; + _clientEndpoints = new EndpointI[0]; + _serverEndpoints = new EndpointI[0]; _adapter = null; _identities.clear(); } @@ -52,78 +52,60 @@ public final class RouterInfo return _router; } - public synchronized Ice.ObjectPrx - getClientProxy() + public synchronized EndpointI[] + getClientEndpoints() { - if(_clientProxy == null) // Lazy initialization. + if(_clientEndpoints == null) // Lazy initialization. { - _clientProxy = _router.getClientProxy(); - if(_clientProxy == null) + Ice.ObjectPrx clientProxy = _router.getClientProxy(); + if(clientProxy == null) { - throw new Ice.NoEndpointException(); + // + // If getClientProxy() return nil, use router endpoints. + // + _clientEndpoints = ((Ice.ObjectPrxHelperBase)_router).__reference().getEndpoints(); } - - _clientProxy = _clientProxy.ice_router(null); // The client proxy cannot be routed. - - // - // In order to avoid creating a new connection to the - // router, we must use the same timeout as the already - // existing connection. - // - try + else { - _clientProxy = _clientProxy.ice_timeout(_router.ice_getConnection().timeout()); - } - catch(Ice.CollocationOptimizationException ex) - { - // Ignore - collocated router. + clientProxy = clientProxy.ice_router(null); // The client proxy cannot be routed. + + // + // In order to avoid creating a new connection to the + // router, we must use the same timeout as the already + // existing connection. + // + try + { + clientProxy = clientProxy.ice_timeout(_router.ice_getConnection().timeout()); + } + catch(Ice.CollocationOptimizationException ex) + { + // Ignore - collocated router. + } + + _clientEndpoints = ((Ice.ObjectPrxHelperBase)clientProxy).__reference().getEndpoints(); } } - return _clientProxy; + return _clientEndpoints; } - public synchronized void - setClientProxy(Ice.ObjectPrx clientProxy) + public synchronized EndpointI[] + getServerEndpoints() { - _clientProxy = clientProxy.ice_router(null); // The client proxy cannot be routed. - - // - // In order to avoid creating a new connection to the router, - // we must use the same timeout as the already existing - // connection. - // - try - { - _clientProxy = _clientProxy.ice_timeout(_router.ice_getConnection().timeout()); - } - catch(Ice.CollocationOptimizationException ex) - { - // Ignore - collocated router. - } - } - - public Ice.ObjectPrx - getServerProxy() - { - if(_serverProxy == null) // Lazy initialization. + if(_serverEndpoints == null) // Lazy initialization. { - _serverProxy = _router.getServerProxy(); - if(_serverProxy == null) + Ice.ObjectPrx serverProxy = _router.getServerProxy(); + if(serverProxy == null) { throw new Ice.NoEndpointException(); } - _serverProxy = _serverProxy.ice_router(null); // The server proxy cannot be routed. + serverProxy = serverProxy.ice_router(null); // The server proxy cannot be routed. + _serverEndpoints = ((Ice.ObjectPrxHelperBase)serverProxy).__reference().getEndpoints(); } - return _serverProxy; - } - - public void - setServerProxy(Ice.ObjectPrx serverProxy) - { - _serverProxy = serverProxy.ice_router(null); // The server proxy cannot be routed. + return _serverEndpoints; } public synchronized void @@ -168,8 +150,8 @@ public final class RouterInfo } private final Ice.RouterPrx _router; - private Ice.ObjectPrx _clientProxy; - private Ice.ObjectPrx _serverProxy; + private EndpointI[] _clientEndpoints; + private EndpointI[] _serverEndpoints; private Ice.ObjectAdapter _adapter; private java.util.HashSet _identities = new java.util.HashSet(); } |