summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-12-08 20:28:03 +0100
committerJose <jose@zeroc.com>2015-12-08 20:28:03 +0100
commit37efdbd76513a056b1ef884d0acbed8e4d5f4bde (patch)
tree4b0c3af21b2c02b757837bb1964c6d4468ca1b52 /cpp/src
parentC++ slicing objects test fixes (diff)
downloadice-37efdbd76513a056b1ef884d0acbed8e4d5f4bde.tar.bz2
ice-37efdbd76513a056b1ef884d0acbed8e4d5f4bde.tar.xz
ice-37efdbd76513a056b1ef884d0acbed8e4d5f4bde.zip
C++11 mapping IceDiscovery plug-in
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/LocatorInfo.cpp21
-rw-r--r--cpp/src/IceDiscovery/LocatorI.cpp60
-rw-r--r--cpp/src/IceDiscovery/LocatorI.h45
-rw-r--r--cpp/src/IceDiscovery/LookupI.cpp118
-rw-r--r--cpp/src/IceDiscovery/LookupI.h102
-rw-r--r--cpp/src/IceDiscovery/PluginI.cpp22
-rw-r--r--cpp/src/Makefile3
-rw-r--r--cpp/src/Makefile.mak3
8 files changed, 342 insertions, 32 deletions
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp
index f3477c972cc..68db941c94b 100644
--- a/cpp/src/Ice/LocatorInfo.cpp
+++ b/cpp/src/Ice/LocatorInfo.cpp
@@ -46,13 +46,14 @@ public:
try
{
#ifdef ICE_CPP11_MAPPING
+ LocatorInfo::RequestPtr request = this;
_locatorInfo->getLocator()->findObjectById_async(
_ref->getIdentity(),
- [this](const ObjectPrxPtr& object)
+ [request](const ObjectPrxPtr& object)
{
- this->response(object);
+ request->response(object);
},
- [this](exception_ptr e)
+ [request](exception_ptr e)
{
try
{
@@ -60,7 +61,7 @@ public:
}
catch(const UserException& ex)
{
- this->exception(ex);
+ request->exception(ex);
}
});
#else
@@ -92,13 +93,13 @@ public:
try
{
#ifdef ICE_CPP11_MAPPING
- _locatorInfo->getLocator()->findAdapterById_async(
- _ref->getAdapterId(),
- [this](const Ice::ObjectPrxPtr& object)
+ LocatorInfo::RequestPtr request = this;
+ _locatorInfo->getLocator()->findAdapterById_async(_ref->getAdapterId(),
+ [request](const shared_ptr<Ice::ObjectPrx>& object)
{
- this->response(object);
+ request->response(object);
},
- [this](exception_ptr e)
+ [request](exception_ptr e)
{
try
{
@@ -106,7 +107,7 @@ public:
}
catch(const UserException& ex)
{
- this->exception(ex);
+ request->exception(ex);
}
});
#else
diff --git a/cpp/src/IceDiscovery/LocatorI.cpp b/cpp/src/IceDiscovery/LocatorI.cpp
index 196c1dcaa5d..fe7b6122115 100644
--- a/cpp/src/IceDiscovery/LocatorI.cpp
+++ b/cpp/src/IceDiscovery/LocatorI.cpp
@@ -23,11 +23,21 @@ LocatorRegistryI::LocatorRegistryI(const Ice::CommunicatorPtr& com) :
{
}
+
+#ifdef ICE_CPP11_MAPPING
+void
+LocatorRegistryI::setAdapterDirectProxy_async(const string& adapterId,
+ const shared_ptr<ObjectPrx>& proxy,
+ function<void ()> response,
+ function<void (const exception_ptr&)>,
+ const Ice::Current&)
+#else
void
LocatorRegistryI::setAdapterDirectProxy_async(const AMD_LocatorRegistry_setAdapterDirectProxyPtr& cb,
const std::string& adapterId,
const ObjectPrxPtr& proxy,
const Current&)
+#endif
{
Lock sync(*this);
if(proxy)
@@ -38,9 +48,22 @@ LocatorRegistryI::setAdapterDirectProxy_async(const AMD_LocatorRegistry_setAdapt
{
_adapters.erase(adapterId);
}
+#ifdef ICE_CPP11_MAPPING
+ response();
+#else
cb->ice_response();
+#endif
}
+#ifdef ICE_CPP11_MAPPING
+void
+LocatorRegistryI::setReplicatedAdapterDirectProxy_async(const string& adapterId,
+ const string& replicaGroupId,
+ const shared_ptr<ObjectPrx>& proxy,
+ function<void ()> response,
+ function<void (const exception_ptr&)>,
+ const Ice::Current&)
+#else
void
LocatorRegistryI::setReplicatedAdapterDirectProxy_async(
const AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr& cb,
@@ -48,6 +71,7 @@ LocatorRegistryI::setReplicatedAdapterDirectProxy_async(
const std::string& replicaGroupId,
const ObjectPrxPtr& proxy,
const Current&)
+#endif
{
Lock sync(*this);
if(proxy)
@@ -73,9 +97,24 @@ LocatorRegistryI::setReplicatedAdapterDirectProxy_async(
}
}
}
+#ifdef ICE_CPP11_MAPPING
+ response();
+#else
cb->ice_response();
+#endif
}
+#ifdef ICE_CPP11_MAPPING
+void
+LocatorRegistryI::setServerProcessProxy_async(const string&,
+ const shared_ptr<ProcessPrx>&,
+ function<void ()> response,
+ function<void (const exception_ptr&)>,
+ const Ice::Current&)
+{
+ response();
+}
+#else
void
LocatorRegistryI::setServerProcessProxy_async(const AMD_LocatorRegistry_setServerProcessProxyPtr& cb,
const std::string&,
@@ -84,6 +123,7 @@ LocatorRegistryI::setServerProcessProxy_async(const AMD_LocatorRegistry_setServe
{
cb->ice_response();
}
+#endif
Ice::ObjectPrxPtr
LocatorRegistryI::findObject(const Ice::Identity& id) const
@@ -184,6 +224,25 @@ LocatorI::LocatorI(const LookupIPtr& lookup, const LocatorRegistryPrxPtr& regist
{
}
+#ifdef ICE_CPP11_MAPPING
+void
+LocatorI::findObjectById_async(const Ice::Identity& id,
+ function<void (const shared_ptr<ObjectPrx>&)> response,
+ function<void (const exception_ptr&)>,
+ const Ice::Current&) const
+{
+ _lookup->findObject(response, id);
+}
+
+void
+LocatorI::findAdapterById_async(const std::string& adapterId,
+ function<void (const shared_ptr<ObjectPrx>&)> response,
+ function<void (const exception_ptr&)>,
+ const Ice::Current&) const
+{
+ _lookup->findAdapter(response, adapterId);
+}
+#else
void
LocatorI::findObjectById_async(const AMD_Locator_findObjectByIdPtr& cb,
const Identity& id,
@@ -199,6 +258,7 @@ LocatorI::findAdapterById_async(const AMD_Locator_findAdapterByIdPtr& cb,
{
_lookup->findAdapter(cb, adapterId);
}
+#endif
LocatorRegistryPrxPtr
LocatorI::getRegistry(const Current&) const
diff --git a/cpp/src/IceDiscovery/LocatorI.h b/cpp/src/IceDiscovery/LocatorI.h
index 230d8c4e7c9..9bc375b6495 100644
--- a/cpp/src/IceDiscovery/LocatorI.h
+++ b/cpp/src/IceDiscovery/LocatorI.h
@@ -24,19 +24,41 @@ public:
LocatorRegistryI(const Ice::CommunicatorPtr&);
+#ifdef ICE_CPP11_MAPPING
+ virtual void
+ setAdapterDirectProxy_async(const std::string&,
+ const std::shared_ptr<Ice::ObjectPrx>&,
+ std::function<void ()>,
+ std::function<void (const std::exception_ptr&)>,
+ const Ice::Current&);
+
+ virtual void
+ setReplicatedAdapterDirectProxy_async(const std::string&, const std::string&,
+ const std::shared_ptr<Ice::ObjectPrx>&,
+ std::function<void ()>,
+ std::function<void (const std::exception_ptr&)>,
+ const Ice::Current&);
+
+ virtual void
+ setServerProcessProxy_async(const std::string&,
+ const std::shared_ptr<Ice::ProcessPrx>&,
+ std::function<void ()>,
+ std::function<void (const std::exception_ptr&)>,
+ const Ice::Current&);
+#else
virtual void
setAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setAdapterDirectProxyPtr&, const std::string&,
- const Ice::ObjectPrxPtr&, const Ice::Current&);
+ const Ice::ObjectPrx&, const Ice::Current&);
virtual void
setReplicatedAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr&,
- const std::string&, const std::string&, const Ice::ObjectPrxPtr&,
+ const std::string&, const std::string&, const Ice::ObjectPrx&,
const Ice::Current&);
virtual void
setServerProcessProxy_async(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr&, const std::string&,
- const Ice::ProcessPrxPtr&, const Ice::Current&);
-
+ const Ice::ProcessPrx&, const Ice::Current&);
+#endif
Ice::ObjectPrxPtr findObject(const Ice::Identity&) const;
Ice::ObjectPrxPtr findAdapter(const std::string&, bool&) const;
@@ -57,6 +79,19 @@ public:
LocatorI(const LookupIPtr&, const Ice::LocatorRegistryPrxPtr&);
+#ifdef ICE_CPP11_MAPPING
+ virtual void
+ findObjectById_async(const Ice::Identity&,
+ std::function<void (const std::shared_ptr<Ice::ObjectPrx>&)>,
+ std::function<void (const std::exception_ptr&)>,
+ const Ice::Current&) const;
+
+ virtual void
+ findAdapterById_async(const std::string&,
+ std::function<void (const std::shared_ptr<Ice::ObjectPrx>&)>,
+ std::function<void (const std::exception_ptr&)>,
+ const Ice::Current&) const;
+#else
virtual void
findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr&, const Ice::Identity&,
const Ice::Current&) const;
@@ -64,7 +99,7 @@ public:
virtual void
findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr&, const std::string&,
const Ice::Current&) const;
-
+#endif
virtual Ice::LocatorRegistryPrxPtr getRegistry(const Ice::Current&) const;
private:
diff --git a/cpp/src/IceDiscovery/LookupI.cpp b/cpp/src/IceDiscovery/LookupI.cpp
index 54835ed4de0..d44a97f287a 100644
--- a/cpp/src/IceDiscovery/LookupI.cpp
+++ b/cpp/src/IceDiscovery/LookupI.cpp
@@ -19,6 +19,7 @@ using namespace std;
using namespace Ice;
using namespace IceDiscovery;
+#ifndef ICE_CPP11_MAPPING
IceDiscovery::Request::Request(const LookupIPtr& lookup, int retryCount) : _lookup(lookup), _nRetry(retryCount)
{
}
@@ -28,6 +29,7 @@ IceDiscovery::Request::retry()
{
return --_nRetry >= 0;
}
+#endif
bool
AdapterRequest::retry()
@@ -43,8 +45,8 @@ AdapterRequest::response(const Ice::ObjectPrxPtr& proxy, bool isReplicaGroup)
if(_latency == IceUtil::Time())
{
_latency = (IceUtil::Time::now() - _start) * _lookup->latencyMultiplier();
- _lookup->timer()->cancel(this);
- _lookup->timer()->schedule(this, _latency);
+ _lookup->timer()->cancel(ICE_SHARED_FROM_THIS);
+ _lookup->timer()->schedule(ICE_SHARED_FROM_THIS, _latency);
}
_proxies.push_back(proxy);
return false;
@@ -53,6 +55,35 @@ AdapterRequest::response(const Ice::ObjectPrxPtr& proxy, bool isReplicaGroup)
return true;
}
+#ifdef ICE_CPP11_MAPPING
+void
+AdapterRequest::finished(const Ice::ObjectPrxPtr& proxy)
+{
+ if(proxy || _proxies.empty())
+ {
+ Request<string>::finished(proxy);
+ return;
+ }
+ else if(_proxies.size() == 1)
+ {
+ Request<string>::finished(_proxies[0]);
+ return;
+ }
+
+ EndpointSeq endpoints;
+ shared_ptr<ObjectPrx> prx;
+ for(vector<shared_ptr<ObjectPrx>>::const_iterator p = _proxies.begin(); p != _proxies.end(); ++p)
+ {
+ if(!prx)
+ {
+ prx = *p;
+ }
+ Ice::EndpointSeq endpts = (*p)->ice_getEndpoints();
+ copy(endpts.begin(), endpts.end(), back_inserter(endpoints));
+ }
+ Request<string>::finished(prx->ice_endpoints(endpoints));
+}
+#else
void
AdapterRequest::finished(const Ice::ObjectPrxPtr& proxy)
{
@@ -80,11 +111,16 @@ AdapterRequest::finished(const Ice::ObjectPrxPtr& proxy)
}
RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>::finished(prx->ice_endpoints(endpoints));
}
+#endif
void
AdapterRequest::runTimerTask()
{
+#ifdef ICE_CPP11_MAPPING
+ _lookup->adapterRequestTimedOut(dynamic_pointer_cast<AdapterRequest>(shared_from_this()));
+#else
_lookup->adapterRequestTimedOut(this);
+#endif
}
void
@@ -96,7 +132,11 @@ ObjectRequest::response(const Ice::ObjectPrxPtr& proxy)
void
ObjectRequest::runTimerTask()
{
+#ifdef ICE_CPP11_MAPPING
+ _lookup->objectRequestTimedOut(dynamic_pointer_cast<ObjectRequest>(shared_from_this()));
+#else
_lookup->objectRequestTimedOut(this);
+#endif
}
LookupI::LookupI(const LocatorRegistryIPtr& registry, const LookupPrxPtr& lookup, const Ice::PropertiesPtr& properties) :
@@ -133,13 +173,13 @@ LookupI::destroy()
}
void
-LookupI::setLookupReply(const LookupReplyPrx& lookupReply)
+LookupI::setLookupReply(const LookupReplyPrxPtr& lookupReply)
{
_lookupReply = lookupReply;
}
void
-LookupI::findObjectById(const string& domainId, const Ice::Identity& id, const IceDiscovery::LookupReplyPrx& reply,
+LookupI::findObjectById(const string& domainId, const Ice::Identity& id, const IceDiscovery::LookupReplyPrxPtr& reply,
const Ice::Current&)
{
if(domainId != _domainId)
@@ -155,7 +195,11 @@ LookupI::findObjectById(const string& domainId, const Ice::Identity& id, const I
//
try
{
+#ifdef ICE_CPP11_MAPPING
+ reply->foundObjectById_async(id, proxy);
+#else
reply->begin_foundObjectById(id, proxy);
+#endif
}
catch(const Ice::LocalException&)
{
@@ -166,7 +210,7 @@ LookupI::findObjectById(const string& domainId, const Ice::Identity& id, const I
void
LookupI::findAdapterById(const string& domainId, const std::string& adapterId,
- const IceDiscovery::LookupReplyPrx& reply, const Ice::Current&)
+ const IceDiscovery::LookupReplyPrxPtr& reply, const Ice::Current&)
{
if(domainId != _domainId)
{
@@ -182,7 +226,11 @@ LookupI::findAdapterById(const string& domainId, const std::string& adapterId,
//
try
{
+#ifdef ICE_CPP11_MAPPING
+ reply->foundAdapterById_async(adapterId, proxy, isReplicaGroup);
+#else
reply->begin_foundAdapterById(adapterId, proxy, isReplicaGroup);
+#endif
}
catch(const Ice::LocalException&)
{
@@ -191,6 +239,57 @@ LookupI::findAdapterById(const string& domainId, const std::string& adapterId,
}
}
+#ifdef ICE_CPP11_MAPPING
+void
+LookupI::findObject(function<void (const shared_ptr<Ice::ObjectPrx>&)> response, const Ice::Identity& id)
+{
+ Lock sync(*this);
+ map<Ice::Identity, ObjectRequestPtr>::iterator p = _objectRequests.find(id);
+ if(p == _objectRequests.end())
+ {
+ p = _objectRequests.insert(make_pair(id, make_shared<ObjectRequest>(shared_from_this(), id, _retryCount))).first;
+ }
+
+ if(p->second->addCallback(response))
+ {
+ try
+ {
+ _lookup->findObjectById_async(_domainId, id, _lookupReply);
+ _timer->schedule(p->second, _timeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ p->second->finished(nullptr);
+ _objectRequests.erase(p);
+ }
+ }
+}
+
+void
+LookupI::findAdapter(function<void (const shared_ptr<Ice::ObjectPrx>&)> response, const std::string& adapterId)
+{
+ Lock sync(*this);
+ map<string, AdapterRequestPtr>::iterator p = _adapterRequests.find(adapterId);
+ if(p == _adapterRequests.end())
+ {
+ p = _adapterRequests.insert(make_pair(adapterId, make_shared<AdapterRequest>(shared_from_this(), adapterId, _retryCount))).first;
+ }
+
+ if(p->second->addCallback(response))
+ {
+ try
+ {
+ _lookup->findAdapterById_async(_domainId, adapterId, _lookupReply);
+ _timer->schedule(p->second, _timeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ p->second->finished(0);
+ _adapterRequests.erase(p);
+ }
+ }
+}
+#else
void
LookupI::findObject(const Ice::AMD_Locator_findObjectByIdPtr& cb, const Ice::Identity& id)
{
@@ -240,6 +339,7 @@ LookupI::findAdapter(const Ice::AMD_Locator_findAdapterByIdPtr& cb, const std::s
}
}
}
+#endif
void
LookupI::foundObject(const Ice::Identity& id, const Ice::ObjectPrxPtr& proxy)
@@ -287,7 +387,11 @@ LookupI::objectRequestTimedOut(const ObjectRequestPtr& request)
{
try
{
+#ifdef ICE_CPP11_MAPPING
+ _lookup->findObjectById_async(_domainId, request->getId(), _lookupReply);
+#else
_lookup->begin_findObjectById(_domainId, request->getId(), _lookupReply);
+#endif
_timer->schedule(p->second, _timeout);
return;
}
@@ -315,7 +419,11 @@ LookupI::adapterRequestTimedOut(const AdapterRequestPtr& request)
{
try
{
+#ifdef ICE_CPP11_MAPPING
+ _lookup->findAdapterById_async(_domainId, request->getId(), _lookupReply);
+#else
_lookup->begin_findAdapterById(_domainId, request->getId(), _lookupReply);
+#endif
_timer->schedule(p->second, _timeout);
return;
}
diff --git a/cpp/src/IceDiscovery/LookupI.h b/cpp/src/IceDiscovery/LookupI.h
index fd854167fb0..ad242f0d6d0 100644
--- a/cpp/src/IceDiscovery/LookupI.h
+++ b/cpp/src/IceDiscovery/LookupI.h
@@ -21,6 +21,98 @@ namespace IceDiscovery
class LookupI;
+#ifdef ICE_CPP11_MAPPING
+
+
+template<class T> class Request :
+ public IceUtil::TimerTask,
+ public std::enable_shared_from_this<Request<T>>
+{
+public:
+
+ Request(std::shared_ptr<LookupI> lookup, const T& id, int retryCount) :
+ _lookup(lookup),
+ _id(id),
+ _nRetry(retryCount)
+ {
+ }
+
+ T getId() const
+ {
+ return _id;
+ }
+
+ virtual bool retry()
+ {
+ return --_nRetry >= 0;
+ }
+
+ bool addCallback(std::function<void (const std::shared_ptr<::Ice::ObjectPrx>&)> cb)
+ {
+ _callbacks.push_back(cb);
+ return _callbacks.size() == 1;
+ }
+
+ virtual void finished(const Ice::ObjectPrxPtr& proxy)
+ {
+ for(auto cb : _callbacks)
+ {
+ cb(proxy);
+ }
+ _callbacks.clear();
+ }
+
+protected:
+
+ LookupIPtr _lookup;
+ const T _id;
+ int _nRetry;
+ std::vector<std::function<void (const std::shared_ptr<::Ice::ObjectPrx>&)>> _callbacks;
+};
+
+class ObjectRequest : public Request<Ice::Identity>
+{
+public:
+
+ ObjectRequest(const std::shared_ptr<LookupI>& lookup, const Ice::Identity& id, int retryCount) :
+ Request<Ice::Identity>(lookup, id, retryCount)
+ {
+ }
+
+ void response(const std::shared_ptr<Ice::ObjectPrx>&);
+
+private:
+
+ virtual void runTimerTask();
+};
+typedef std::shared_ptr<ObjectRequest> ObjectRequestPtr;
+
+class AdapterRequest : public Request<std::string>
+{
+public:
+
+ AdapterRequest(std::shared_ptr<LookupI> lookup, const std::string& adapterId, int retryCount) :
+ Request<std::string>(lookup, adapterId, retryCount),
+ _start(IceUtil::Time::now())
+ {
+ }
+
+ bool response(const std::shared_ptr<Ice::ObjectPrx>&, bool);
+
+ virtual bool retry();
+ virtual void finished(const std::shared_ptr<Ice::ObjectPrx>&);
+
+private:
+
+ virtual void runTimerTask();
+ std::vector<Ice::ObjectPrxPtr> _proxies;
+ IceUtil::Time _start;
+ IceUtil::Time _latency;
+};
+typedef std::shared_ptr<AdapterRequest> AdapterRequestPtr;
+
+#else
+
class Request : public IceUtil::TimerTask
{
public:
@@ -109,8 +201,11 @@ private:
IceUtil::Time _latency;
};
typedef IceUtil::Handle<AdapterRequest> AdapterRequestPtr;
+#endif
-class LookupI : public Lookup, private IceUtil::Mutex
+class LookupI : public Lookup,
+ private IceUtil::Mutex,
+ public ICE_ENABLE_SHARED_FROM_THIS(LookupI)
{
public:
@@ -126,8 +221,13 @@ public:
virtual void findAdapterById(const std::string&, const std::string&, const IceDiscovery::LookupReplyPrxPtr&,
const Ice::Current&);
+#ifdef ICE_CPP11_MAPPING
+ void findObject(std::function<void (const std::shared_ptr<Ice::ObjectPrx>&)>, const Ice::Identity&);
+ void findAdapter(std::function<void (const std::shared_ptr<Ice::ObjectPrx>&)>, const std::string&);
+#else
void findObject(const Ice::AMD_Locator_findObjectByIdPtr&, const Ice::Identity&);
void findAdapter(const Ice::AMD_Locator_findAdapterByIdPtr&, const std::string&);
+#endif
void foundObject(const Ice::Identity&, const Ice::ObjectPrxPtr&);
void foundAdapter(const std::string&, const Ice::ObjectPrxPtr&, bool);
diff --git a/cpp/src/IceDiscovery/PluginI.cpp b/cpp/src/IceDiscovery/PluginI.cpp
index e0e1a7f9849..538bb7c43a5 100644
--- a/cpp/src/IceDiscovery/PluginI.cpp
+++ b/cpp/src/IceDiscovery/PluginI.cpp
@@ -105,9 +105,9 @@ PluginI::initialize()
//
// Setup locatory registry.
//
- LocatorRegistryIPtr locatorRegistry = new LocatorRegistryI(_communicator);
- Ice::LocatorRegistryPrx locatorRegistryPrx =
- Ice::LocatorRegistryPrx::uncheckedCast(_locatorAdapter->addWithUUID(locatorRegistry));
+ LocatorRegistryIPtr locatorRegistry = ICE_MAKE_SHARED(LocatorRegistryI, _communicator);
+ Ice::LocatorRegistryPrxPtr locatorRegistryPrx =
+ ICE_UNCHECKED_CAST(Ice::LocatorRegistryPrx, _locatorAdapter->addWithUUID(locatorRegistry));
string lookupEndpoints = properties->getProperty("IceDiscovery.Lookup");
if(lookupEndpoints.empty())
@@ -121,17 +121,21 @@ PluginI::initialize()
lookupEndpoints = os.str();
}
- Ice::ObjectPrx lookupPrx = _communicator->stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints);
+ Ice::ObjectPrxPtr lookupPrx = _communicator->stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints);
lookupPrx = lookupPrx->ice_collocationOptimized(false); // No collocation optimization for the multicast proxy!
try
{
// Ensure we can establish a connection to the multicast proxy
// but don't block.
+#ifdef ICE_CPP11_MAPPING
+ lookupPrx->ice_getConnection();
+#else
Ice::AsyncResultPtr result = lookupPrx->begin_ice_getConnection();
if(result->sentSynchronously())
{
lookupPrx->end_ice_getConnection(result);
}
+#endif
}
catch(const Ice::LocalException& ex)
{
@@ -145,17 +149,17 @@ PluginI::initialize()
//
// Add lookup and lookup reply Ice objects
//
- _lookup = new LookupI(locatorRegistry, LookupPrx::uncheckedCast(lookupPrx), properties);
+ _lookup = ICE_MAKE_SHARED(LookupI, locatorRegistry, ICE_UNCHECKED_CAST(LookupPrx, lookupPrx), properties);
_multicastAdapter->add(_lookup, _communicator->stringToIdentity("IceDiscovery/Lookup"));
- Ice::ObjectPrx lookupReply = _replyAdapter->addWithUUID(new LookupReplyI(_lookup))->ice_datagram();
- _lookup->setLookupReply(LookupReplyPrx::uncheckedCast(lookupReply));
+ Ice::ObjectPrxPtr lookupReply = _replyAdapter->addWithUUID(ICE_MAKE_SHARED(LookupReplyI, _lookup))->ice_datagram();
+ _lookup->setLookupReply(ICE_UNCHECKED_CAST(LookupReplyPrx, lookupReply));
//
// Setup locator on the communicator.
//
- Ice::ObjectPrx loc = _locatorAdapter->addWithUUID(new LocatorI(_lookup, locatorRegistryPrx));
- _communicator->setDefaultLocator(Ice::LocatorPrx::uncheckedCast(loc));
+ Ice::ObjectPrxPtr loc = _locatorAdapter->addWithUUID(ICE_MAKE_SHARED(LocatorI, _lookup, locatorRegistryPrx));
+ _communicator->setDefaultLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, loc));
_multicastAdapter->activate();
_replyAdapter->activate();
diff --git a/cpp/src/Makefile b/cpp/src/Makefile
index 0b4354e707a..12c87196c3f 100644
--- a/cpp/src/Makefile
+++ b/cpp/src/Makefile
@@ -16,7 +16,8 @@ ifeq ($(CPP11_MAPPING),yes)
Slice \
slice2cpp \
Ice \
- IceSSL
+ IceSSL \
+ IceDiscovery
else
ifneq ($(findstring MINGW,$(UNAME)),)
diff --git a/cpp/src/Makefile.mak b/cpp/src/Makefile.mak
index 204980bcc3e..3dea3e0f4e7 100644
--- a/cpp/src/Makefile.mak
+++ b/cpp/src/Makefile.mak
@@ -23,7 +23,8 @@ SUBDIRS = IceUtil \
Slice \
slice2cpp \
Ice \
- IceSSL
+ IceSSL \
+ IceDiscovery
!elseif "$(CPP_COMPILER)" == "VC100"
SUBDIRS = IceUtil \
Slice \