summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Reference.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2009-04-24 10:38:36 -0230
committerDwayne Boone <dwayne@zeroc.com>2009-04-24 10:38:36 -0230
commit6b433842110070262d21b7261d2408b5e5f49a51 (patch)
tree5821bf2289f3b73f0963aeb1de8e88454167e470 /cpp/src/Ice/Reference.cpp
parentBug 1618 - default logger format (diff)
downloadice-6b433842110070262d21b7261d2408b5e5f49a51.tar.bz2
ice-6b433842110070262d21b7261d2408b5e5f49a51.tar.xz
ice-6b433842110070262d21b7261d2408b5e5f49a51.zip
Bug 1666 - use of ice_throw
Diffstat (limited to 'cpp/src/Ice/Reference.cpp')
-rw-r--r--cpp/src/Ice/Reference.cpp115
1 files changed, 58 insertions, 57 deletions
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 29c177567c0..c04f6f45b22 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -872,7 +872,8 @@ ReferencePtr
IceInternal::RoutableReference::changeCompress(bool newCompress) const
{
ReferencePtr r = Reference::changeCompress(newCompress);
- if(r.get() != const_cast<RoutableReference*>(this) && !_endpoints.empty()) // Also override the compress flag on the endpoints if it was updated.
+ // Also override the compress flag on the endpoints if it was updated.
+ if(r.get() != const_cast<RoutableReference*>(this) && !_endpoints.empty())
{
vector<EndpointIPtr> newEndpoints;
for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
@@ -1434,28 +1435,28 @@ IceInternal::RoutableReference::getConnection(const GetConnectionCallbackPtr& ca
virtual void
setEndpoints(const vector<EndpointIPtr>& endpoints)
+ {
+ vector<EndpointIPtr> endpts = endpoints;
+ if(!endpts.empty())
{
- vector<EndpointIPtr> endpts = endpoints;
- if(!endpts.empty())
- {
- _reference->applyOverrides(endpts);
- _reference->createConnection(endpts, _callback);
- return;
- }
-
- _reference->getConnectionNoRouterInfo(_callback);
+ _reference->applyOverrides(endpts);
+ _reference->createConnection(endpts, _callback);
+ return;
}
+ _reference->getConnectionNoRouterInfo(_callback);
+ }
+
virtual void
setException(const Ice::LocalException& ex)
- {
- _callback->setException(ex);
- }
+ {
+ _callback->setException(ex);
+ }
Callback(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& callback) :
_reference(reference), _callback(callback)
- {
- }
+ {
+ }
private:
@@ -1489,46 +1490,46 @@ IceInternal::RoutableReference::getConnectionNoRouterInfo(const GetConnectionCal
virtual void
setConnection(const Ice::ConnectionIPtr& connection, bool compress)
- {
- _callback->setConnection(connection, compress);
- }
+ {
+ _callback->setConnection(connection, compress);
+ }
virtual void
setException(const Ice::LocalException& exc)
+ {
+ try
{
- try
- {
- exc.ice_throw();
- }
- catch(const Ice::NoEndpointException& ex)
- {
- _callback->setException(ex); // No need to retry if there's no endpoints.
- }
- catch(const Ice::LocalException& ex)
+ throw;
+ }
+ catch(const Ice::NoEndpointException& ex)
+ {
+ _callback->setException(ex); // No need to retry if there's no endpoints.
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ LocatorInfoPtr locatorInfo = _reference->getLocatorInfo();
+ assert(locatorInfo);
+ locatorInfo->clearCache(_reference);
+ if(_cached)
{
- LocatorInfoPtr locatorInfo = _reference->getLocatorInfo();
- assert(locatorInfo);
- locatorInfo->clearCache(_reference);
- if(_cached)
- {
- TraceLevelsPtr traceLvls = _reference->getInstance()->traceLevels();
- if(traceLvls->retry >= 2)
+ TraceLevelsPtr traceLvls = _reference->getInstance()->traceLevels();
+ if(traceLvls->retry >= 2)
{
- Trace out(_reference->getInstance()->initializationData().logger, traceLvls->retryCat);
- out << "connection to cached endpoints failed\n"
- << "removing endpoints from cache and trying one more time\n" << ex;
- }
- _reference->getConnectionNoRouterInfo(_callback); // Retry.
- return;
+ Trace out(_reference->getInstance()->initializationData().logger, traceLvls->retryCat);
+ out << "connection to cached endpoints failed\n"
+ << "removing endpoints from cache and trying one more time\n" << ex;
}
- _callback->setException(ex);
+ _reference->getConnectionNoRouterInfo(_callback); // Retry.
+ return;
}
+ _callback->setException(ex);
}
+ }
Callback2(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& cb, bool cached) :
_reference(reference), _callback(cb), _cached(cached)
- {
- }
+ {
+ }
private:
@@ -1540,28 +1541,28 @@ IceInternal::RoutableReference::getConnectionNoRouterInfo(const GetConnectionCal
virtual void
setEndpoints(const vector<EndpointIPtr>& endpoints, bool cached)
+ {
+ if(endpoints.empty())
{
- if(endpoints.empty())
- {
- _callback->setException(Ice::NoEndpointException(__FILE__, __LINE__, _reference->toString()));
- return;
- }
-
- vector<EndpointIPtr> endpts = endpoints;
- _reference->applyOverrides(endpts);
- _reference->createConnection(endpts, new Callback2(_reference, _callback, cached));
+ _callback->setException(Ice::NoEndpointException(__FILE__, __LINE__, _reference->toString()));
+ return;
}
+ vector<EndpointIPtr> endpts = endpoints;
+ _reference->applyOverrides(endpts);
+ _reference->createConnection(endpts, new Callback2(_reference, _callback, cached));
+ }
+
virtual void
setException(const Ice::LocalException& ex)
- {
- _callback->setException(ex);
- }
+ {
+ _callback->setException(ex);
+ }
Callback(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& callback) :
_reference(reference), _callback(callback)
- {
- }
+ {
+ }
private: