diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/LocatorInfo.cpp | 16 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 22 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 14 | ||||
-rw-r--r-- | cpp/src/Ice/ProxyFactory.cpp | 19 | ||||
-rw-r--r-- | cpp/src/Ice/ProxyFactory.h | 2 |
6 files changed, 37 insertions, 42 deletions
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index 50e16b9ef32..91531d24648 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -17,7 +17,6 @@ #include <Ice/Reference.h> #include <Ice/Functional.h> #include <Ice/IdentityUtil.h> - #include <iterator> using namespace std; @@ -185,7 +184,6 @@ void IceInternal::LocatorTable::addProxy(const Identity& id, const ObjectPrx& proxy) { IceUtil::Mutex::Lock sync(*this); - _objectMap.insert(make_pair(id, proxy)); } @@ -201,9 +199,7 @@ IceInternal::LocatorTable::removeProxy(const Identity& id) } ObjectPrx proxy = p->second; - _objectMap.erase(p); - return proxy; } @@ -294,18 +290,20 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca } else { + bool objectCached = true; if(!_table->getProxy(ref->getIdentity(), object)) { - cached = false; - + objectCached = false; object = _locator->findObjectById(ref->getIdentity()); } + bool endpointsCached = true; if(object) { DirectReferencePtr odr = DirectReferencePtr::dynamicCast(object->__reference()); if(odr) { + endpointsCached = false; endpoints = odr->getEndpoints(); } else @@ -314,15 +312,17 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca assert(oir); if(!oir->getAdapterId().empty()) { - endpoints = getEndpoints(oir, cached); + endpoints = getEndpoints(oir, endpointsCached); } } } - if(!cached && !endpoints.empty()) + if(!objectCached && !endpoints.empty()) { _table->addProxy(ref->getIdentity(), object); } + + cached = objectCached || endpointsCached; } } catch(const AdapterNotFoundException&) diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index da5b5e3185e..4c444b54ed5 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -191,7 +191,11 @@ IceInternal::Outgoing::invoke() // guarantees that all outstanding requests can safely // be repeated. // - if(dynamic_cast<CloseConnectionException*>(_exception.get())) + // An ObjectNotExistException can always be retried as + // well without violating "at-most-once". + // + if(dynamic_cast<CloseConnectionException*>(_exception.get()) || + dynamic_cast<ObjectNotExistException*>(_exception.get())) { _exception->ice_throw(); } diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 558efb747ad..044b0dbca0f 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -204,12 +204,6 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc) if(_reference) { - IndirectReferencePtr ir = IndirectReferencePtr::dynamicCast(_reference); - if(ir && ir->getLocatorInfo()) - { - ir->getLocatorInfo()->clearObjectCache(ir); - } - bool doRetry = false; // @@ -221,14 +215,18 @@ IceInternal::OutgoingAsync::__finished(const LocalException& exc) // can also retry if the operation mode is Nonmutating or // Idempotent. // - if(_mode == Nonmutating || _mode == Idempotent || dynamic_cast<const CloseConnectionException*>(&exc)) + // An ObjectNotExistException can always be retried as + // well without violating "at-most-once". + // + if(_mode == Nonmutating || _mode == Idempotent || dynamic_cast<const CloseConnectionException*>(&exc) || + dynamic_cast<const ObjectNotExistException*>(&exc)) { try { ProxyFactoryPtr proxyFactory = _reference->getInstance()->proxyFactory(); if(proxyFactory) { - proxyFactory->checkRetryAfterException(exc, _cnt); + proxyFactory->checkRetryAfterException(exc, _reference, _cnt); } else { @@ -373,16 +371,10 @@ IceInternal::OutgoingAsync::__send() } catch(const LocalException& ex) { - IndirectReferencePtr ir = IndirectReferencePtr::dynamicCast(_reference); - if(ir && ir->getLocatorInfo()) - { - ir->getLocatorInfo()->clearObjectCache(ir); - } - ProxyFactoryPtr proxyFactory = _reference->getInstance()->proxyFactory(); if(proxyFactory) { - proxyFactory->checkRetryAfterException(ex, _cnt); + proxyFactory->checkRetryAfterException(ex, _reference, _cnt); } else { diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 761841d3c5f..b2dc3e67db9 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -688,12 +688,6 @@ IceProxy::Ice::Object::__handleException(const LocalException& ex, int& cnt) _delegate = 0; } - IndirectReferencePtr ir = IndirectReferencePtr::dynamicCast(_reference); - if(ir && ir->getLocatorInfo()) - { - ir->getLocatorInfo()->clearObjectCache(ir); - } - if(ice_isOneway() || ice_isBatchOneway()) { // @@ -712,7 +706,7 @@ IceProxy::Ice::Object::__handleException(const LocalException& ex, int& cnt) ProxyFactoryPtr proxyFactory = _reference->getInstance()->proxyFactory(); if(proxyFactory) { - proxyFactory->checkRetryAfterException(ex, cnt); + proxyFactory->checkRetryAfterException(ex, _reference, cnt); } else { @@ -734,12 +728,6 @@ IceProxy::Ice::Object::__rethrowException(const LocalException& ex) _delegate = 0; } - IndirectReferencePtr ir = IndirectReferencePtr::dynamicCast(_reference); - if(ir && ir->getLocatorInfo()) - { - ir->getLocatorInfo()->clearObjectCache(ir); - } - ex.ice_throw(); } diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index 7a06429de1b..31f08404e25 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -13,6 +13,7 @@ #include <Ice/Instance.h> #include <Ice/Proxy.h> #include <Ice/ReferenceFactory.h> +#include <Ice/LocatorInfo.h> #include <Ice/BasicStream.h> #include <Ice/Properties.h> #include <Ice/LoggerUtil.h> @@ -87,13 +88,23 @@ IceInternal::ProxyFactory::referenceToProxy(const ReferencePtr& ref) const } void -IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, int& cnt) const +IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, const ReferencePtr& ref, int& cnt) const { // - // We don't retry *NotExistException, which are all derived from - // RequestFailedException. + // We retry ObjectNotExistException if the reference is + // indirect. Otherwise, we don't retry other *NotExistException, + // which are all derived from RequestFailedException. // - if(dynamic_cast<const RequestFailedException*>(&ex)) + if(dynamic_cast<const ObjectNotExistException*>(&ex)) + { + IndirectReferencePtr ir = IndirectReferencePtr::dynamicCast(ref); + if(!ir || !ir->getLocatorInfo()) + { + ex.ice_throw(); + } + ir->getLocatorInfo()->clearObjectCache(ir); + } + else if(dynamic_cast<const RequestFailedException*>(&ex)) { ex.ice_throw(); } diff --git a/cpp/src/Ice/ProxyFactory.h b/cpp/src/Ice/ProxyFactory.h index ffc35b2b205..c45ed72350c 100644 --- a/cpp/src/Ice/ProxyFactory.h +++ b/cpp/src/Ice/ProxyFactory.h @@ -35,7 +35,7 @@ public: Ice::ObjectPrx referenceToProxy(const ReferencePtr&) const; - void checkRetryAfterException(const Ice::LocalException&, int&) const; + void checkRetryAfterException(const Ice::LocalException&, const ReferencePtr&, int&) const; private: |