diff options
author | Benoit Foucher <benoit@zeroc.com> | 2008-02-14 18:08:59 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2008-02-14 18:08:59 +0100 |
commit | a95ccc73ef5572109532f3e94498d31df106195d (patch) | |
tree | 0062b9c56c133da43a9c7ff5536e9d5b5dbaae89 /cpp/src/Ice/ProxyFactory.cpp | |
parent | Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff) | |
download | ice-a95ccc73ef5572109532f3e94498d31df106195d.tar.bz2 ice-a95ccc73ef5572109532f3e94498d31df106195d.tar.xz ice-a95ccc73ef5572109532f3e94498d31df106195d.zip |
- Fixed bug 2688
- Fixed bug 2674
- Changed connection validation to always use non-blocking IO (bug 1981)
- Added distribution/src/common/RELEASE_NOTES.txt
- Moved distribution/src/windows/README.DEMOS to distribution/src/common
Diffstat (limited to 'cpp/src/Ice/ProxyFactory.cpp')
-rw-r--r-- | cpp/src/Ice/ProxyFactory.cpp | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index bd378d74896..48e9460bada 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -19,13 +19,38 @@ #include <Ice/LoggerUtil.h> #include <Ice/TraceLevels.h> #include <Ice/LocalException.h> +#include <Ice/OutgoingAsync.h> using namespace std; using namespace Ice; using namespace IceInternal; -IceUtil::Shared* IceInternal::upCast(ProxyFactory* p) { return p; } +namespace +{ + +class RetryTask : public IceUtil::TimerTask +{ +public: + + RetryTask(const OutgoingAsyncPtr& out) : _out(out) + { + } + + virtual void + runTimerTask() + { + _out->__send(); + } + +private: + + const OutgoingAsyncPtr _out; +}; + +} +IceUtil::Shared* IceInternal::upCast(ProxyFactory* p) { return p; } + ObjectPrx IceInternal::ProxyFactory::stringToProxy(const string& str) const { @@ -95,7 +120,10 @@ IceInternal::ProxyFactory::referenceToProxy(const ReferencePtr& ref) const } void -IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, const ReferencePtr& ref, int& cnt) const +IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, + const ReferencePtr& ref, + OutgoingAsync* out, + int& cnt) const { TraceLevelsPtr traceLevels = _instance->traceLevels(); LoggerPtr logger = _instance->initializationData().logger; @@ -138,6 +166,11 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co Trace out(logger, traceLevels->retryCat); out << "retrying operation call to add proxy to router\n" << ex; } + + if(out) + { + out->__send(); + } return; // We must always retry, so we don't look at the retry count. } else @@ -213,10 +246,24 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co if(interval > 0) { - // - // Sleep before retrying. - // - IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(interval)); + if(out) + { + _instance->timer()->schedule(new RetryTask(out), IceUtil::Time::milliSeconds(interval)); + } + else + { + // + // Sleep before retrying. + // + IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(interval)); + } + } + else + { + if(out) + { + out->__send(); + } } } |