diff options
author | Michi Henning <michi@zeroc.com> | 2003-09-04 02:11:46 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2003-09-04 02:11:46 +0000 |
commit | 5ecbdf0ebe5efd151129d4422b30b7aefe11f9db (patch) | |
tree | fca4840b748039de1d06e78170bb3c6ca23f6933 /cpp/src/Ice/ObjectAdapterFactory.cpp | |
parent | Fixed IcePack test cleaning (diff) | |
download | ice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.tar.bz2 ice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.tar.xz ice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.zip |
Fixed race condition in flushBatchRequests(): connections that are not yet
validated are now ignored when flushing.
Diffstat (limited to 'cpp/src/Ice/ObjectAdapterFactory.cpp')
-rw-r--r-- | cpp/src/Ice/ObjectAdapterFactory.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index c87ce94bf31..569317fb33f 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -143,6 +143,33 @@ IceInternal::ObjectAdapterFactory::findObjectAdapter(const ObjectPrx& proxy) return 0; } +namespace IceInternal { + +struct FlushAdapter +{ + void operator() (ObjectAdapterIPtr p) + { + p->flushBatchRequests(); + } +}; + +} + +void +IceInternal::ObjectAdapterFactory::flushBatchRequests() const +{ + list<ObjectAdapterIPtr> a; + { + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + + for(map<string, ObjectAdapterIPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) + { + a.push_back(p->second); + } + } + for_each(a.begin(), a.end(), FlushAdapter()); +} + IceInternal::ObjectAdapterFactory::ObjectAdapterFactory(const InstancePtr& instance, const CommunicatorPtr& communicator) : _instance(instance), |