diff options
author | Marc Laukien <marc@zeroc.com> | 2001-10-04 22:13:32 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-10-04 22:13:32 +0000 |
commit | 264f935e12f77e8adb8b1daca82b89df503d3bf3 (patch) | |
tree | 7a4b1f00e9f8949fc62fe767b7bdb86e7ec81ff1 /cpp | |
parent | active connection management (diff) | |
download | ice-264f935e12f77e8adb8b1daca82b89df503d3bf3.tar.bz2 ice-264f935e12f77e8adb8b1daca82b89df503d3bf3.tar.xz ice-264f935e12f77e8adb8b1daca82b89df503d3bf3.zip |
fixes
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/demo/Ice/nested/config | 4 | ||||
-rw-r--r-- | cpp/doc/Properties.sgml | 4 | ||||
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 30 |
3 files changed, 23 insertions, 15 deletions
diff --git a/cpp/demo/Ice/nested/config b/cpp/demo/Ice/nested/config index 48ead53c181..20f87371ef3 100644 --- a/cpp/demo/Ice/nested/config +++ b/cpp/demo/Ice/nested/config @@ -1,7 +1,7 @@ Nested.NestedServer=nestedServer:tcp -p 10000 -t 1000 Ice.Adapter.NestedServerAdapter.Endpoints=tcp -p 10000 -t 1000 Ice.Adapter.NestedClientAdapter.Endpoints=tcp -t 1000 -Ice.Trace.Network=1 +#Ice.Trace.Network=1 #Ice.Trace.Protocol=1 Ice.ThreadPool.Size=3 -Ice.ThreadPool.MaxConnections=3
\ No newline at end of file +Ice.ThreadPool.MaxConnections=4
\ No newline at end of file diff --git a/cpp/doc/Properties.sgml b/cpp/doc/Properties.sgml index 70219c8814e..49e36e1f706 100644 --- a/cpp/doc/Properties.sgml +++ b/cpp/doc/Properties.sgml @@ -219,8 +219,8 @@ Ice.ThreadPool.MaxConnections=<replaceable>num</replaceable> <para> The maximum number of connections the thread pool will use. Default is zero, meaning no limit. If <replaceable>num</replaceable> is not set -to zero, it must be equal to or larger than the number of threads in -the thread pool. +to zero, it must be set to a value larger than the number of threads +in the thread pool. </para> </section> </section> diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 5738d6e4754..3d91161cbcb 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -129,9 +129,9 @@ void IceInternal::ThreadPool::setMaxConnections(int maxConnections) { JTCSyncT<JTCMonitorT<JTCMutex> > sync(*this); - if (maxConnections < _threadNum && maxConnections != 0) + if (maxConnections < _threadNum + 1 && maxConnections != 0) { - _maxConnections = _threadNum; + _maxConnections = _threadNum + 1; } else { @@ -376,18 +376,27 @@ IceInternal::ThreadPool::run() // // Check if there are connections to reap. // + reap = false; // _handlerMap.size() is faster than _reapList() with most STLs. if (_maxConnections > 0 && _handlerMap.size() > static_cast<list<int>::size_type>(_maxConnections)) { - int fd = _reapList.back(); - _reapList.pop_back(); - _reapList.push_front(fd); - map<int, pair<EventHandlerPtr, list<int>::iterator> >::iterator p = _handlerMap.find(fd); - p->second.second = _reapList.begin(); - handler = p->second.first; - reap = true; + for (list<int>::reverse_iterator p = _reapList.rbegin(); p != _reapList.rend(); ++p) + { + int fd = *p; + if (fd != -1) + { + _reapList.pop_back(); + _reapList.push_front(-1); + map<int, pair<EventHandlerPtr, list<int>::iterator> >::iterator q = _handlerMap.find(fd); + q->second.second = _reapList.begin(); + handler = q->second.first; + reap = true; + break; + } + } } - else + + if (!reap) { // // Round robin for the filedescriptors. @@ -437,7 +446,6 @@ IceInternal::ThreadPool::run() } handler = p->second.first; - reap = false; } } |