summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/LocatorI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2002-08-22 22:52:31 +0000
committerBenoit Foucher <benoit@zeroc.com>2002-08-22 22:52:31 +0000
commit8ee8c08018e63d5b5b6c505490e27dcb3ef766db (patch)
tree4f888dacbe96952a910eb969a5428aba67030e7b /cpp/src/IcePack/LocatorI.cpp
parentbug fix for identity reuse in add() (diff)
downloadice-8ee8c08018e63d5b5b6c505490e27dcb3ef766db.tar.bz2
ice-8ee8c08018e63d5b5b6c505490e27dcb3ef766db.tar.xz
ice-8ee8c08018e63d5b5b6c505490e27dcb3ef766db.zip
Added support for IcePack node and re-factored many things in IcePack.
Diffstat (limited to 'cpp/src/IcePack/LocatorI.cpp')
-rw-r--r--cpp/src/IcePack/LocatorI.cpp53
1 files changed, 37 insertions, 16 deletions
diff --git a/cpp/src/IcePack/LocatorI.cpp b/cpp/src/IcePack/LocatorI.cpp
index 67c16fb72e9..4facdcc9c2e 100644
--- a/cpp/src/IcePack/LocatorI.cpp
+++ b/cpp/src/IcePack/LocatorI.cpp
@@ -9,43 +9,64 @@
// **********************************************************************
#include <Ice/Ice.h>
-
-#include <IcePack/AdapterManager.h>
#include <IcePack/LocatorI.h>
using namespace std;
-using namespace Ice;
using namespace IcePack;
-IcePack::LocatorI::LocatorI(const AdapterManagerPrx& adapters, const LocatorRegistryPrx& registry) :
- _adapters(adapters),
- _registry(registry)
+IcePack::LocatorI::LocatorI(const AdapterRegistryPtr& adapterRegistry,
+ const Ice::LocatorRegistryPrx& locatorRegistry) :
+ _adapterRegistry(adapterRegistry),
+ _locatorRegistry(locatorRegistry)
{
}
Ice::ObjectPrx
-IcePack::LocatorI::findAdapterByName(const string& name, const Current&) const
+IcePack::LocatorI::findAdapterByName(const string& name, const Ice::Current&) const
{
+ //
+ // TODO: I think will need to do something more sensible in cases
+ // where the adapter is found but the adapter proxy is null
+ // (possibly because the server activation failed or timed out) or
+ // if the adapter object isn't reachable (possibly because the
+ // IcePack node is down or unreachable). Right now the Ice cleint
+ // will always throw a NoEndpointException because we return a
+ // null proxy here...
+ //
+
try
{
- AdapterPrx adapter = _adapters->findByName(name);
- if(adapter)
- {
- return adapter->getDirectProxy(true);
- }
+ return _adapterRegistry->findByName(name)->getDirectProxy(true);
+ }
+ catch(const AdapterNotExistException&)
+ {
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ //
+ // Expected if the adapter is destroyed.
+ //
}
- catch (const AdapterActivationTimeoutException&)
+ catch(const Ice::NoEndpointException&)
{
+ //
+ // This could be because we can't locate the IcePack node
+ // adapter. IcePack server adapter proxy are not direct proxy.
+ //
}
- catch (const ObjectNotExistException&)
+ catch(const Ice::LocalException&)
{
+ //
+ // Expected if we couldn't contact the adapter object
+ // (possibly because the IcePack node is down).
+ //
}
return 0;
}
Ice::LocatorRegistryPrx
-IcePack::LocatorI::getRegistry(const Current&) const
+IcePack::LocatorI::getRegistry(const Ice::Current&) const
{
- return _registry;
+ return _locatorRegistry;
}