diff options
author | Marc Laukien <marc@zeroc.com> | 2004-11-01 22:52:46 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-11-01 22:52:46 +0000 |
commit | 2c8d38517d58868e4be35c0bf652d17707266ded (patch) | |
tree | e766d1d6f1d3dc1e6f4c958eeb0b6e1a1307f48b /cpp/src | |
parent | more glacier2 (diff) | |
download | ice-2c8d38517d58868e4be35c0bf652d17707266ded.tar.bz2 ice-2c8d38517d58868e4be35c0bf652d17707266ded.tar.xz ice-2c8d38517d58868e4be35c0bf652d17707266ded.zip |
more glacier2
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Glacier2/Blobject.cpp | 9 | ||||
-rw-r--r-- | cpp/src/Glacier2/Glacier2Router.cpp | 5 | ||||
-rw-r--r-- | cpp/src/Glacier2/RequestQueue.cpp | 1 | ||||
-rw-r--r-- | cpp/src/Glacier2/RequestQueue.h | 8 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 19 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 15 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 27 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.h | 7 | ||||
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 6 |
12 files changed, 49 insertions, 54 deletions
diff --git a/cpp/src/Glacier2/Blobject.cpp b/cpp/src/Glacier2/Blobject.cpp index 75eaa79d2ca..3af5b8db76e 100644 --- a/cpp/src/Glacier2/Blobject.cpp +++ b/cpp/src/Glacier2/Blobject.cpp @@ -19,8 +19,6 @@ static const string serverUnbuffered = "Glacier2.Server.Unbuffered"; static const string clientUnbuffered = "Glacier2.Client.Unbuffered"; static const string serverAlwaysBatch = "Glacier2.Server.AlwaysBatch"; static const string clientAlwaysBatch = "Glacier2.Client.AlwaysBatch"; -static const string serverThreadStackSize = "Glacier2.Server.ThreadStackSize"; -static const string clientThreadStackSize = "Glacier2.Client.ThreadStackSize"; static const string serverTraceRequest = "Glacier2.Server.Trace.Request"; static const string clientTraceRequest = "Glacier2.Client.Trace.Request"; static const string serverTraceOverride = "Glacier2.Server.Trace.Override"; @@ -51,15 +49,14 @@ Glacier2::Blobject::Blobject(const CommunicatorPtr& communicator, bool reverse) { if(!_unbuffered) { - Int threadStackSize = _reverse ? - _properties->getPropertyAsInt(serverThreadStackSize) : - _properties->getPropertyAsInt(clientThreadStackSize); - IceUtil::Time sleepTime = _reverse ? IceUtil::Time::milliSeconds(communicator->getProperties()->getPropertyAsInt(serverSleepTime)) : IceUtil::Time::milliSeconds(communicator->getProperties()->getPropertyAsInt(clientSleepTime)); _requestQueue = new RequestQueue(sleepTime); + + Int threadStackSize = _properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize"); + _requestQueue->start(static_cast<size_t>(threadStackSize)); } } diff --git a/cpp/src/Glacier2/Glacier2Router.cpp b/cpp/src/Glacier2/Glacier2Router.cpp index 648528c5cd8..4bc5cd07464 100644 --- a/cpp/src/Glacier2/Glacier2Router.cpp +++ b/cpp/src/Glacier2/Glacier2Router.cpp @@ -204,6 +204,11 @@ Glacier2::RouterService::initializeCommunicator(int& argc, char* argv[]) PropertiesPtr defaultProperties = getDefaultProperties(argc, argv); // + // Glacier2 always runs in thread-per-connection mode. + // + defaultProperties->setProperty("Ice.ThreadPerConnection", "1"); + + // // Make sure that Glacier2 doesn't use a router. // defaultProperties->setProperty("Ice.Default.Router", ""); diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp index 4eb7b0c408d..c5bf57386a3 100644 --- a/cpp/src/Glacier2/RequestQueue.cpp +++ b/cpp/src/Glacier2/RequestQueue.cpp @@ -92,6 +92,7 @@ Glacier2::Request::getProxy() const } Glacier2::RequestQueue::RequestQueue(const IceUtil::Time& sleepTime) : + _sleepTime(sleepTime), _destroy(false) { } diff --git a/cpp/src/Glacier2/RequestQueue.h b/cpp/src/Glacier2/RequestQueue.h index dc2cc567995..949e001cf5d 100644 --- a/cpp/src/Glacier2/RequestQueue.h +++ b/cpp/src/Glacier2/RequestQueue.h @@ -20,7 +20,7 @@ namespace Glacier2 class Request; typedef IceUtil::Handle<Request> RequestPtr; -class Request : public Ice::AMI_Object_ice_invoke +class Request : public IceUtil::Shared { public: @@ -31,12 +31,6 @@ public: bool override(const RequestPtr&) const; const Ice::ObjectPrx& getProxy() const; - // - // From AMI_Object_ice_invoke. - // - virtual void ice_response(bool, const std::vector<Ice::Byte>&); - virtual void ice_exception(const Ice::Exception&); - private: const Ice::ObjectPrx _proxy; diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 21f64d94500..821ad2c42ae 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -857,7 +857,7 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance // accepts new connections on this endpoint. // _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this); - _threadPerIncomingConnectionFactory->start(); + _threadPerIncomingConnectionFactory->start(_instance->threadPerConnectionStackSize()); } } } diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 47d87f34a0b..94f3be39829 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1367,7 +1367,7 @@ Ice::ConnectionI::ConnectionI(const InstancePtr& instance, // for this connection. // _threadPerConnection = new ThreadPerConnection(this); - _threadPerConnection->start(); + _threadPerConnection->start(_instance->threadPerConnectionStackSize()); } vector<Byte>& requestHdr = const_cast<vector<Byte>&>(_requestHdr); diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index a80d74dd3f7..8e45317871e 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -288,6 +288,13 @@ IceInternal::Instance::threadPerConnection() const return _threadPerConnection; } +size_t +IceInternal::Instance::threadPerConnectionStackSize() const +{ + // No mutex lock, immutable. + return _threadPerConnectionStackSize; +} + EndpointFactoryManagerPtr IceInternal::Instance::endpointFactoryManager() const { @@ -368,7 +375,8 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope _properties(properties), _messageSizeMax(0), _connectionIdleTime(0), - _threadPerConnection(false) + _threadPerConnection(false), + _threadPerConnectionStackSize(0) { try @@ -542,6 +550,15 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope const_cast<bool&>(_threadPerConnection) = _properties->getPropertyAsInt("Ice.ThreadPerConnection") > 0; + { + Int stackSize = _properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize"); + if(stackSize < 0) + { + stackSize = 0; + } + const_cast<size_t&>(_threadPerConnectionStackSize) = static_cast<size_t>(stackSize); + } + _routerManager = new RouterManager; _locatorManager = new LocatorManager; diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h index 38407b4a870..465ef967a7f 100644 --- a/cpp/src/Ice/Instance.h +++ b/cpp/src/Ice/Instance.h @@ -66,6 +66,7 @@ public: ThreadPoolPtr clientThreadPool(); ThreadPoolPtr serverThreadPool(); bool threadPerConnection() const; + size_t threadPerConnectionStackSize() const; EndpointFactoryManagerPtr endpointFactoryManager() const; DynamicLibraryListPtr dynamicLibraryList() const; Ice::PluginManagerPtr pluginManager() const; @@ -100,6 +101,7 @@ private: ThreadPoolPtr _clientThreadPool; ThreadPoolPtr _serverThreadPool; const bool _threadPerConnection; + const size_t _threadPerConnectionStackSize; EndpointFactoryManagerPtr _endpointFactoryManager; DynamicLibraryListPtr _dynamicLibraryList; Ice::PluginManagerPtr _pluginManager; diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 247823bf690..efe7c75389f 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -134,6 +134,7 @@ static const string iceProps[] = "ThreadPool.Server.SizeWarn", "ThreadPool.Server.StackSize", "ThreadPerConnection", + "ThreadPerConnection.StackSize", "Trace.GC", "Trace.Location", "Trace.Network", @@ -340,30 +341,24 @@ static const string glacierProps[] = static const string glacier2Props[] = { + "Client.AlwaysBatch", "Client.Endpoints", "Client.ForwardContext", "Client.SleepTime", - "Client.ThreadPool.Size", - "Client.ThreadPool.SizeMax", - "Client.ThreadPool.SizeWarn", - "Client.ThreadPool.StackSize", - "Client.ThreadStackSize", "Client.Trace.Override", "Client.Trace.Reject", "Client.Trace.Request", + "Client.Unbuffered", "CryptPasswords", "PermissionsVerifier", "RouterIdentity", + "Server.AlwaysBatch", "Server.Endpoints", "Server.ForwardContext", "Server.SleepTime", - "Server.ThreadPool.Size", - "Server.ThreadPool.SizeMax", - "Server.ThreadPool.SizeWarn", - "Server.ThreadPool.StackSize", - "Server.ThreadStackSize", "Server.Trace.Override", "Server.Trace.Request", + "Server.Unbuffered", "SessionManager", "SessionTimeout", "Trace.RoutingTable", diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index db2d0600c2b..4705dfad427 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -553,14 +553,6 @@ IceInternal::FixedReference::streamWrite(BasicStream* s) const throw ex; } -string -IceInternal::FixedReference::toString() const -{ - MarshalException ex(__FILE__, __LINE__); - ex.reason = "Cannot stringify a fixed reference"; - throw ex; -} - ConnectionIPtr IceInternal::FixedReference::getConnection(bool& compress) const { @@ -680,18 +672,6 @@ IceInternal::RoutableReference::changeTimeout(int newTimeout) const return RoutableReferencePtr(const_cast<RoutableReference*>(this)); } -void -IceInternal::RoutableReference::streamWrite(BasicStream* s) const -{ - Reference::streamWrite(s); -} - -string -IceInternal::RoutableReference::toString() const -{ - return Reference::toString(); -} - bool IceInternal::RoutableReference::operator==(const Reference& r) const { @@ -1011,10 +991,11 @@ IceInternal::IndirectReference::toString() const } result.append(" @ "); + // - // If the encoded adapter id string contains characters which - // the reference parser uses as separators, then we enclose - // the adapter id string in quotes. + // If the encoded adapter id string contains characters which the + // reference parser uses as separators, then we enclose the + // adapter id string in quotes. // string a = IceUtil::escapeString(adapterId, ""); if(a.find_first_of(" \t\n\r") != string::npos) diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index 01dbdab1ab3..12c37e4aede 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -76,12 +76,12 @@ public: // // Marshal the reference. // - virtual void streamWrite(BasicStream*) const = 0; + virtual void streamWrite(BasicStream*) const; // // Convert the reference to its string form. // - virtual std::string toString() const = 0; + virtual std::string toString() const; // // Get a suitable connection for this reference. @@ -133,7 +133,6 @@ public: virtual std::vector<EndpointPtr> getEndpoints() const; virtual void streamWrite(BasicStream*) const; - virtual std::string toString() const; virtual Ice::ConnectionIPtr getConnection(bool&) const; virtual bool operator==(const Reference&) const; @@ -164,8 +163,6 @@ public: virtual ReferencePtr changeCompress(bool) const; virtual ReferencePtr changeTimeout(int) const; - virtual void streamWrite(BasicStream*) const = 0; - virtual std::string toString() const = 0; virtual Ice::ConnectionIPtr getConnection(bool&) const = 0; virtual bool operator==(const Reference&) const = 0; diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 6b9e1a3660b..88d4f515388 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -41,6 +41,12 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p _promote(true), _warnUdp(_instance->properties()->getPropertyAsInt("Ice.Warn.Datagrams") > 0) { + // + // If we are in thread per connection mode, no thread pool should + // ever be created. + // + assert(!_instance->threadPerConnection()); + SOCKET fds[2]; createPipe(fds); _fdIntrRead = fds[0]; |