From 872141e1f6b150b0e752260fd3d312577d18f2fb Mon Sep 17 00:00:00 2001 From: Marc Laukien Date: Tue, 4 Apr 2006 18:31:22 +0000 Subject: attack test --- cpp/src/Ice/ProxyFactory.cpp | 51 +++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'cpp/src/Ice/ProxyFactory.cpp') diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index d758934f9cd..5f9c93cc0a3 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -90,34 +90,54 @@ IceInternal::ProxyFactory::referenceToProxy(const ReferencePtr& ref) const void IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, const ReferencePtr& ref, int& cnt) const { - if(dynamic_cast(&ex)) + TraceLevelsPtr traceLevels = _instance->traceLevels(); + LoggerPtr logger = _instance->logger(); + + const ObjectNotExistException* one = dynamic_cast(&ex); + + if(one) { - // - // We retry ObjectNotExistException if the reference is - // indirect. Otherwise, we don't retry other - // *NotExistException, which are all derived from - // RequestFailedException. - // LocatorInfoPtr li = ref->getLocatorInfo(); if(li) { + // + // We retry ObjectNotExistException if the reference is + // indirect. + // li->clearObjectCache(IndirectReferencePtr::dynamicCast(ref)); } - else + else if(ref->getRouterInfo() && one->operation == "ice_add_proxy") { // - // TODO: For now, we retry on ObjectNotExistException if - // we are using a router, to handle proxies evicted by the - // router. + // If we have a router, an ObjectNotExistException with an + // operation name "ice_add_proxy" indicates to the client + // that the router isn't aware of the proxy (for example, + // because it was evicted by the router). In this case, we + // must *always* retry, so that the missing proxy is added + // to the router. // - if(!ref->getRouterInfo()) + if(traceLevels->retry >= 1) { - ex.ice_throw(); + Trace out(logger, traceLevels->retryCat); + out << "retrying operation call to add proxy to router\n" << ex; } + return; // We must always retry, so we don't look at the retry count. + } + else + { + // + // For all other cases, we don't retry + // ObjectNotExistException. + // + ex.ice_throw(); } } else if(dynamic_cast(&ex)) { + // + // We don't retry other *NotExistException, which are all + // derived from RequestFailedException. + // ex.ice_throw(); } @@ -151,9 +171,6 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co ++cnt; assert(cnt > 0); - TraceLevelsPtr traceLevels = _instance->traceLevels(); - LoggerPtr logger = _instance->logger(); - if(cnt > static_cast(_retryIntervals.size())) { if(traceLevels->retry >= 1) @@ -169,7 +186,7 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co if(traceLevels->retry >= 1) { Trace out(logger, traceLevels->retryCat); - out << "re-trying operation call"; + out << "retrying operation call"; if(interval > 0) { out << " in " << interval << "ms"; -- cgit v1.2.3