diff options
author | Benoit Foucher <benoit@zeroc.com> | 2004-02-19 16:24:46 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2004-02-19 16:24:46 +0000 |
commit | 46b7c3565ff6785144f1807782276edbc29e5b9d (patch) | |
tree | ff73ec6c2cebd4a05ffb1d7527debb9704744bcb /cpp | |
parent | fix (diff) | |
download | ice-46b7c3565ff6785144f1807782276edbc29e5b9d.tar.bz2 ice-46b7c3565ff6785144f1807782276edbc29e5b9d.tar.xz ice-46b7c3565ff6785144f1807782276edbc29e5b9d.zip |
IcePack fixes
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/config/IcePackAdmin.py | 54 | ||||
-rw-r--r-- | cpp/src/IcePack/IcePackNode.cpp | 7 | ||||
-rw-r--r-- | cpp/src/IcePack/Registry.cpp | 9 | ||||
-rwxr-xr-x | cpp/test/IcePack/deployer/run.py | 12 | ||||
-rwxr-xr-x | cpp/test/IcePack/simple/run.py | 15 |
5 files changed, 70 insertions, 27 deletions
diff --git a/cpp/config/IcePackAdmin.py b/cpp/config/IcePackAdmin.py index 9f5d25deba0..9503725e74c 100644 --- a/cpp/config/IcePackAdmin.py +++ b/cpp/config/IcePackAdmin.py @@ -15,6 +15,7 @@ import sys, os, TestUtil import time +from threading import Thread for toplevel in [".", "..", "../..", "../../..", "../../../.."]: toplevel = os.path.normpath(toplevel) @@ -25,6 +26,27 @@ else: icePackPort = "0"; +class ReaderThread(Thread): + def __init__(self, pipe, token): + self.pipe = pipe + self.token = token + Thread.__init__(self) + + def run(self): + + try: + while 1: + line = self.pipe.readline() + if not line: break + print self.token + ": " + line, + except IOError: + pass + + try: + self.pipe.close() + except IOError: + pass + def startIcePackRegistry(port, testdir): global icePackPort @@ -51,14 +73,17 @@ def startIcePackRegistry(port, testdir): r' --IcePack.Registry.Trace.NodeRegistry=0' + \ r' --Ice.ProgramName=icepackregistry' - icePackPipe = os.popen(command) + (stdin, icePackPipe) = os.popen4(command) TestUtil.getServerPid(icePackPipe) TestUtil.getAdapterReady(icePackPipe) TestUtil.getAdapterReady(icePackPipe) TestUtil.getAdapterReady(icePackPipe) TestUtil.getAdapterReady(icePackPipe) print "ok" - return icePackPipe + + readerThread = ReaderThread(icePackPipe, "IcePackRegistry") + readerThread.start() + return readerThread def startIcePackNode(testdir): @@ -68,7 +93,8 @@ def startIcePackNode(testdir): if not os.path.exists(dataDir): os.mkdir(dataDir) - overrideOptions = '"' + TestUtil.clientServerOptions.replace("--", "") + '"' + overrideOptions = '"' + TestUtil.clientServerOptions.replace("--", "") + \ + ' Ice.PrintProcessId=0 Ice.PrintAdapterReady=0' + '"' print "starting icepack node...", command = icePack + TestUtil.clientServerOptions + ' --nowarn ' + \ @@ -83,15 +109,18 @@ def startIcePackNode(testdir): r' --IcePack.Node.Trace.Server=0' + \ r' --IcePack.Node.PrintServersReady=node' - icePackPipe = os.popen(command) + (stdin, icePackPipe) = os.popen4(command) TestUtil.getServerPid(icePackPipe) TestUtil.getAdapterReady(icePackPipe) TestUtil.waitServiceReady(icePackPipe, 'node') print "ok" - return icePackPipe -def shutdownIcePackRegistry(icePackPipe): + readerThread = ReaderThread(icePackPipe, "IcePackNode") + readerThread.start() + return readerThread + +def shutdownIcePackRegistry(): global icePackPort icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") @@ -102,15 +131,14 @@ def shutdownIcePackRegistry(icePackPipe): r' -e "shutdown" ' icePackAdminPipe = os.popen(command) + TestUtil.printOutputFromPipe(icePackAdminPipe) icePackAdminStatus = icePackAdminPipe.close() - icePackPipe.close() - print "ok" - if icePackAdminStatus: TestUtil.killServers() sys.exit(1) + print "ok" -def shutdownIcePackNode(icePackPipe): +def shutdownIcePackNode(): global icePackPort icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") @@ -121,13 +149,12 @@ def shutdownIcePackNode(icePackPipe): r' -e "node shutdown localnode" ' icePackAdminPipe = os.popen(command) + TestUtil.printOutputFromPipe(icePackAdminPipe) icePackAdminStatus = icePackAdminPipe.close() - icePackPipe.close() - print "ok" - if icePackAdminStatus: TestUtil.killServers() sys.exit(1) + print "ok" def addApplication(descriptor, targets): @@ -156,6 +183,7 @@ def removeApplication(descriptor): r' -e "application remove \"' + descriptor + '\\" \"' icePackAdminPipe = os.popen(command) + TestUtil.printOutputFromPipe(icePackAdminPipe) icePackAdminStatus = icePackAdminPipe.close() if icePackAdminStatus: TestUtil.killServers() diff --git a/cpp/src/IcePack/IcePackNode.cpp b/cpp/src/IcePack/IcePackNode.cpp index 9bf09710a4f..0ef1bdb3e6d 100644 --- a/cpp/src/IcePack/IcePackNode.cpp +++ b/cpp/src/IcePack/IcePackNode.cpp @@ -179,6 +179,11 @@ IcePack::NodeService::start(int argc, char* argv[]) // properties->setProperty("Ice.ServerIdleTime", "0"); + if(properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 5) <= 5) + { + properties->setProperty("Ice.ThreadPool.Server.Size", "5"); + } + // // Collocate the IcePack registry if we need to. // @@ -196,7 +201,7 @@ IcePack::NodeService::start(int argc, char* argv[]) // if(properties->getPropertyAsInt("IcePack.Node.ThreadPool.Size") == 0) { - int size = properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 10); + int size = properties->getPropertyAsInt("Ice.ThreadPool.Server.Size"); ostringstream os1; os1 << static_cast<int>(size / 3); diff --git a/cpp/src/IcePack/Registry.cpp b/cpp/src/IcePack/Registry.cpp index b705bc990f5..295057fcf23 100644 --- a/cpp/src/IcePack/Registry.cpp +++ b/cpp/src/IcePack/Registry.cpp @@ -121,11 +121,17 @@ IcePack::Registry::start(bool nowarn, bool requiresInternalEndpoints) out << "administrative endpoints `IcePack.Registry.Admin.Endpoints' enabled"; } } - + + if(properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Server.Size", 5) <= 5) + { + properties->setProperty("Ice.ThreadPool.Server.Size", "5"); + } + _communicator->setDefaultLocator(0); properties->setProperty("Ice.PrintProcessId", "0"); properties->setProperty("Ice.Warn.Leaks", "0"); + properties->setProperty("Ice.ServerIdleTime", "0"); TraceLevelsPtr traceLevels = new TraceLevels(properties, _communicator->getLogger()); @@ -154,7 +160,6 @@ IcePack::Registry::start(bool nowarn, bool requiresInternalEndpoints) registryAdapter->add(serverRegistry, stringToIdentity("IcePack/ServerRegistry")); registryAdapter->add(nodeRegistry, stringToIdentity("IcePack/NodeRegistry")); - // // Create the locator registry adapter and servant. // diff --git a/cpp/test/IcePack/deployer/run.py b/cpp/test/IcePack/deployer/run.py index cd8631e9fc1..f2d577f9fcb 100755 --- a/cpp/test/IcePack/deployer/run.py +++ b/cpp/test/IcePack/deployer/run.py @@ -58,8 +58,8 @@ def startClient(options): # Start IcePack. # IcePackAdmin.cleanDbDir(os.path.join(testdir, "db")) -icePackRegistryPipe = IcePackAdmin.startIcePackRegistry("12346", testdir) -icePackNodePipe = IcePackAdmin.startIcePackNode(testdir) +icePackRegistryThread = IcePackAdmin.startIcePackRegistry("12346", testdir) +icePackNodeThread = IcePackAdmin.startIcePackNode(testdir) # # Deploy the application, run the client and remove the application. @@ -72,7 +72,7 @@ startClient("") print "removing application...", IcePackAdmin.removeApplication(os.path.join(testdir, "application.xml")); -print "ok" +print "ok" # # Deploy the application with some targets to test targets, run the @@ -91,7 +91,9 @@ print "ok" # # Shutdown IcePack. # -IcePackAdmin.shutdownIcePackNode(icePackNodePipe) -IcePackAdmin.shutdownIcePackRegistry(icePackRegistryPipe) +IcePackAdmin.shutdownIcePackNode() +icepackNodeThread.join() +IcePackAdmin.shutdownIcePackRegistry() +icepackRegistryThread.join() sys.exit(0) diff --git a/cpp/test/IcePack/simple/run.py b/cpp/test/IcePack/simple/run.py index 61d0583e8e9..c11f4cf18d7 100755 --- a/cpp/test/IcePack/simple/run.py +++ b/cpp/test/IcePack/simple/run.py @@ -40,7 +40,7 @@ IcePackAdmin.cleanDbDir(os.path.join(testdir, "db")) # # Start IcePack registry. # -icePackRegistryPipe = IcePackAdmin.startIcePackRegistry("12346", testdir) +icePackRegistryThread = IcePackAdmin.startIcePackRegistry("12346", testdir) # # Test client/server without on demand activation. @@ -51,15 +51,16 @@ TestUtil.mixedClientServerTestWithOptions(name, additionalServerOptions, additio # # Shutdown the registry. # -IcePackAdmin.shutdownIcePackRegistry(icePackRegistryPipe) +IcePackAdmin.shutdownIcePackRegistry() +icepackRegistryThread.join() IcePackAdmin.cleanDbDir(os.path.join(testdir, "db")) # # Start IcePack registry and a node. # -icePackRegistryPipe = IcePackAdmin.startIcePackRegistry("12346", testdir) -icePackNodePipe = IcePackAdmin.startIcePackNode(testdir) +icePackRegistryThread = IcePackAdmin.startIcePackRegistry("12346", testdir) +icePackNodeThread = IcePackAdmin.startIcePackNode(testdir) # # Test client/server with on demand activation. @@ -86,7 +87,9 @@ print "unregister server with icepack...", IcePackAdmin.removeServer("server"); print "ok" -IcePackAdmin.shutdownIcePackNode(icePackNodePipe) -IcePackAdmin.shutdownIcePackRegistry(icePackRegistryPipe) +IcePackAdmin.shutdownIcePackNode() +icepackNodeThread.join() +IcePackAdmin.shutdownIcePackRegistry() +icepackRegistryThread.join() sys.exit(0) |