diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-03-03 14:10:40 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-03-03 14:10:40 +0000 |
commit | e642c24a430dc350b3b14b5a925376084f8a7602 (patch) | |
tree | c494bf31e6c52a327e46a47e4fdf0e98872c6784 /cppe/src/IceE/ProxyFactory.cpp | |
parent | Fix (diff) | |
download | ice-e642c24a430dc350b3b14b5a925376084f8a7602.tar.bz2 ice-e642c24a430dc350b3b14b5a925376084f8a7602.tar.xz ice-e642c24a430dc350b3b14b5a925376084f8a7602.zip |
Ported fix for bug 574 and retry test
Diffstat (limited to 'cppe/src/IceE/ProxyFactory.cpp')
-rw-r--r-- | cppe/src/IceE/ProxyFactory.cpp | 77 |
1 files changed, 33 insertions, 44 deletions
diff --git a/cppe/src/IceE/ProxyFactory.cpp b/cppe/src/IceE/ProxyFactory.cpp index a55c3b83233..260ae5e9e70 100644 --- a/cppe/src/IceE/ProxyFactory.cpp +++ b/cppe/src/IceE/ProxyFactory.cpp @@ -115,24 +115,25 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co // // There is no point in retrying an operation that resulted in a - // MarshalException. This must have been raised locally (because if - // it happened in a server it would result in an UnknownLocalException - // instead), which means there was a problem in this process that will - // not change if we try again. + // MarshalException. This must have been raised locally (because + // if it happened in a server it would result in an + // UnknownLocalException instead), which means there was a problem + // in this process that will not change if we try again. // // The most likely cause for a MarshalException is exceeding the // maximum message size, which is represented by the the subclass - // MemoryLimitException. For example, a client can attempt to send a - // message that exceeds the maximum memory size, or accumulate enough - // batch requests without flushing that the maximum size is reached. + // MemoryLimitException. For example, a client can attempt to send + // a message that exceeds the maximum memory size, or accumulate + // enough batch requests without flushing that the maximum size is + // reached. // - // This latter case is especially problematic, because if we were to - // retry a batch request after a MarshalException, we would in fact - // silently discard the accumulated requests and allow new batch - // requests to accumulate. If the subsequent batched requests do not - // exceed the maximum message size, it appears to the client that all - // of the batched requests were accepted, when in reality only the - // last few are actually sent. + // This latter case is especially problematic, because if we were + // to retry a batch request after a MarshalException, we would in + // fact silently discard the accumulated requests and allow new + // batch requests to accumulate. If the subsequent batched + // requests do not exceed the maximum message size, it appears to + // the client that all of the batched requests were accepted, when + // in reality only the last few are actually sent. // if(dynamic_cast<const MarshalException*>(&ex)) { @@ -140,52 +141,40 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co } ++cnt; + assert(cnt > 0); TraceLevelsPtr traceLevels = _instance->traceLevels(); LoggerPtr logger = _instance->logger(); - // - // Instance components may be null if the communicator has been - // destroyed. - // - if(traceLevels && logger) + if(cnt > static_cast<int>(_retryIntervals.size())) { - if(cnt > static_cast<int>(_retryIntervals.size())) - { - if(traceLevels->retry >= 1) - { - Trace out(logger, traceLevels->retryCat); - out << "cannot retry operation call because retry limit has been exceeded\n" << ex.toString(); - } - ex.ice_throw(); - } - if(traceLevels->retry >= 1) { Trace out(logger, traceLevels->retryCat); - out << "re-trying operation call"; - if(cnt > 0 && _retryIntervals[cnt - 1] > 0) - { - out << Ice::printfToString(" in %dms", _retryIntervals[cnt - 1]); - } - out << " because of exception\n" << ex.toString(); + out << "cannot retry operation call because retry limit has been exceeded\n" << ex.toString(); } + ex.ice_throw(); + } + + int interval = _retryIntervals[cnt - 1]; - if(cnt > 0) + if(traceLevels->retry >= 1) + { + Trace out(logger, traceLevels->retryCat); + out << "re-trying operation call"; + if(interval > 0) { - // - // Sleep before retrying. - // - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_retryIntervals[cnt - 1])); + out << Ice::printfToString(" in %dms", interval); } + out << " because of exception\n" << ex.toString(); } - else + + if(cnt > 0) { // - // Impossible to retry after the communicator has been - // destroyed. + // Sleep before retrying. // - ex.ice_throw(); + IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_retryIntervals[cnt - 1])); } } |