summaryrefslogtreecommitdiff
path: root/cpp/src/IceBox
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
committerBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
commitabada90e3f84dc703b8ddc9efcbed8a946fadead (patch)
tree2c6f9dccd510ea97cb927a7bd635422efaae547a /cpp/src/IceBox
parentremoving trace message (diff)
downloadice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip
Expanded tabs into spaces
Diffstat (limited to 'cpp/src/IceBox')
-rw-r--r--cpp/src/IceBox/Admin.cpp130
-rw-r--r--cpp/src/IceBox/Service.cpp6
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp620
-rw-r--r--cpp/src/IceBox/ServiceManagerI.h8
4 files changed, 382 insertions, 382 deletions
diff --git a/cpp/src/IceBox/Admin.cpp b/cpp/src/IceBox/Admin.cpp
index 777f6bc0054..74234008973 100644
--- a/cpp/src/IceBox/Admin.cpp
+++ b/cpp/src/IceBox/Admin.cpp
@@ -58,24 +58,24 @@ Client::run(int argc, char* argv[])
vector<string> commands;
try
{
- commands = opts.parse(argc, (const char**)argv);
+ commands = opts.parse(argc, (const char**)argv);
}
catch(const IceUtil::BadOptException& e)
{
cerr << e.reason << endl;
- usage();
- return EXIT_FAILURE;
+ usage();
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage();
- return EXIT_SUCCESS;
+ usage();
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
if(commands.empty())
@@ -93,34 +93,34 @@ Client::run(int argc, char* argv[])
if(properties->getProperty("Ice.Default.Locator").empty())
{
//
- // DEPRECATED PROPERTY: Remove extra code in future release.
- //
- string managerEndpoints =
- properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.Endpoints",
- properties->getProperty("IceBox.ServiceManager.Endpoints"));
- if(managerEndpoints.empty())
- {
- cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.Endpoints' is not set" << endl;
- return EXIT_FAILURE;
- }
-
- managerProxy = "\"" + communicator()->identityToString(managerIdentity) + "\" :" + managerEndpoints;
+ // DEPRECATED PROPERTY: Remove extra code in future release.
+ //
+ string managerEndpoints =
+ properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.Endpoints",
+ properties->getProperty("IceBox.ServiceManager.Endpoints"));
+ if(managerEndpoints.empty())
+ {
+ cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.Endpoints' is not set" << endl;
+ return EXIT_FAILURE;
+ }
+
+ managerProxy = "\"" + communicator()->identityToString(managerIdentity) + "\" :" + managerEndpoints;
}
else
{
//
- // DEPRECATED PROPERTY: Remove extra code in future release.
- //
- string managerAdapterId =
- properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.AdapterId",
- properties->getProperty("IceBox.ServiceManager.AdapterId"));
- if(managerAdapterId.empty())
- {
- cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.AdapterId' is not set" << endl;
- return EXIT_FAILURE;
- }
-
- managerProxy = "\"" + communicator()->identityToString(managerIdentity) + "\" @" + managerAdapterId;
+ // DEPRECATED PROPERTY: Remove extra code in future release.
+ //
+ string managerAdapterId =
+ properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.AdapterId",
+ properties->getProperty("IceBox.ServiceManager.AdapterId"));
+ if(managerAdapterId.empty())
+ {
+ cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.AdapterId' is not set" << endl;
+ return EXIT_FAILURE;
+ }
+
+ managerProxy = "\"" + communicator()->identityToString(managerIdentity) + "\" @" + managerAdapterId;
}
ObjectPrx base = communicator()->stringToProxy(managerProxy);
@@ -154,48 +154,48 @@ Client::run(int argc, char* argv[])
{
manager->shutdown();
}
- else if((*r) == "start")
- {
- if(++r == commands.end())
- {
+ else if((*r) == "start")
+ {
+ if(++r == commands.end())
+ {
cerr << appName() << ": no service name specified." << endl;
return EXIT_FAILURE;
- }
-
- try
- {
- manager->startService(*r);
- }
- catch(const IceBox::NoSuchServiceException&)
- {
+ }
+
+ try
+ {
+ manager->startService(*r);
+ }
+ catch(const IceBox::NoSuchServiceException&)
+ {
cerr << appName() << ": unknown service `" << *r << "'" << endl;
- }
- catch(const IceBox::AlreadyStartedException&)
- {
+ }
+ catch(const IceBox::AlreadyStartedException&)
+ {
cerr << appName() << ": service already started." << endl;
- }
- }
- else if((*r) == "stop")
- {
- if(++r == commands.end())
- {
+ }
+ }
+ else if((*r) == "stop")
+ {
+ if(++r == commands.end())
+ {
cerr << appName() << ": no service name specified." << endl;
return EXIT_FAILURE;
- }
-
- try
- {
- manager->stopService(*r);
- }
- catch(const IceBox::NoSuchServiceException&)
- {
+ }
+
+ try
+ {
+ manager->stopService(*r);
+ }
+ catch(const IceBox::NoSuchServiceException&)
+ {
cerr << appName() << ": unknown service `" << *r << "'" << endl;
- }
- catch(const IceBox::AlreadyStoppedException&)
- {
+ }
+ catch(const IceBox::AlreadyStoppedException&)
+ {
cerr << appName() << ": service already stopped." << endl;
- }
- }
+ }
+ }
else
{
cerr << appName() << ": unknown command `" << *r << "'" << endl;
diff --git a/cpp/src/IceBox/Service.cpp b/cpp/src/IceBox/Service.cpp
index 881c263fe25..295d0c45817 100644
--- a/cpp/src/IceBox/Service.cpp
+++ b/cpp/src/IceBox/Service.cpp
@@ -88,7 +88,7 @@ IceBox::IceBoxService::stop()
if(_serviceManager)
{
_serviceManager->stop();
- _serviceManager = 0;
+ _serviceManager = 0;
}
return true;
}
@@ -129,8 +129,8 @@ IceBox::IceBoxService::usage(const string& appName)
"\n"
"--daemon Run as a daemon.\n"
"--noclose Do not close open file descriptors.\n"
- "--nochdir Do not change the current working directory.\n"
- "--pidfile <file> Write process ID to <file>."
+ "--nochdir Do not change the current working directory.\n"
+ "--pidfile <file> Write process ID to <file>."
);
#endif
print("Usage: " + appName + " [options]\n" + options);
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index c3097d5b99e..047be74601b 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -53,33 +53,33 @@ IceBox::ServiceManagerI::startService(const string& name, const Current&)
vector<ServiceInfo>::iterator p;
for(p = _services.begin(); p != _services.end(); ++p)
{
- ServiceInfo& info = *p;
- if(info.name == name)
- {
- if(info.active)
- {
- throw AlreadyStartedException();
- }
-
- try
- {
- info.service->start(name, info.communicator == 0 ? _communicator : info.communicator, info.args);
- info.active = true;
- }
- catch(const Ice::Exception& ex)
- {
+ ServiceInfo& info = *p;
+ if(info.name == name)
+ {
+ if(info.active)
+ {
+ throw AlreadyStartedException();
+ }
+
+ try
+ {
+ info.service->start(name, info.communicator == 0 ? _communicator : info.communicator, info.args);
+ info.active = true;
+ }
+ catch(const Ice::Exception& ex)
+ {
Warning out(_logger);
- out << "ServiceManager: exception in start for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ out << "ServiceManager: exception in start for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in start for service " << info.name;
- }
+ out << "ServiceManager: unknown exception in start for service " << info.name;
+ }
- return;
- }
+ return;
+ }
}
throw NoSuchServiceException();
@@ -97,33 +97,33 @@ IceBox::ServiceManagerI::stopService(const string& name, const Current&)
vector<ServiceInfo>::iterator p;
for(p = _services.begin(); p != _services.end(); ++p)
{
- ServiceInfo& info = *p;
- if(info.name == name)
- {
- if(!info.active)
- {
- throw AlreadyStoppedException();
- }
-
- try
- {
- info.service->stop();
- info.active = false;
- }
- catch(const Ice::Exception& ex)
- {
+ ServiceInfo& info = *p;
+ if(info.name == name)
+ {
+ if(!info.active)
+ {
+ throw AlreadyStoppedException();
+ }
+
+ try
+ {
+ info.service->stop();
+ info.active = false;
+ }
+ catch(const Ice::Exception& ex)
+ {
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << info.name;
- }
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
+ }
- return;
- }
+ return;
+ }
}
throw NoSuchServiceException();
@@ -149,10 +149,10 @@ IceBox::ServiceManagerI::start()
//
ObjectAdapterPtr adapter = _communicator->createObjectAdapter("IceBox.ServiceManager");
- PropertiesPtr properties = _communicator->getProperties();
+ PropertiesPtr properties = _communicator->getProperties();
Identity identity;
- identity.category = properties->getPropertyWithDefault("IceBox.InstanceName", "IceBox");
- identity.name = "ServiceManager";
+ identity.category = properties->getPropertyWithDefault("IceBox.InstanceName", "IceBox");
+ identity.name = "ServiceManager";
adapter->add(obj, identity);
//
@@ -191,7 +191,7 @@ IceBox::ServiceManagerI::start()
//
const string prefix = "IceBox.Service.";
PropertyDict services = properties->getPropertiesForPrefix(prefix);
- PropertyDict::iterator p;
+ PropertyDict::iterator p;
for(StringSeq::const_iterator q = loadOrder.begin(); q != loadOrder.end(); ++q)
{
p = services.find(prefix + *q);
@@ -204,8 +204,8 @@ IceBox::ServiceManagerI::start()
load(*q, p->second);
services.erase(p);
}
- for(p = services.begin(); p != services.end(); ++p)
- {
+ for(p = services.begin(); p != services.end(); ++p)
+ {
string name = p->first.substr(prefix.size());
load(name, p->second);
}
@@ -228,16 +228,16 @@ IceBox::ServiceManagerI::start()
cout << bundleName << " ready" << endl;
}
- try
- {
- adapter->activate();
- }
- catch(const ObjectAdapterDeactivatedException&)
- {
- //
- // Expected if the communicator has been shutdown.
- //
- }
+ try
+ {
+ adapter->activate();
+ }
+ catch(const ObjectAdapterDeactivatedException&)
+ {
+ //
+ // Expected if the communicator has been shutdown.
+ //
+ }
}
catch(const FailureException& ex)
{
@@ -279,16 +279,16 @@ IceBox::ServiceManagerI::load(const string& name, const string& value)
else
{
entryPoint = value.substr(0, pos);
- try
- {
- args = IceUtil::Options::split(value.substr(pos + 1));
- }
- catch(const IceUtil::BadOptException& ex)
- {
- FailureException e(__FILE__, __LINE__);
- e.reason = "ServiceManager: invalid arguments for service `" + name + "':\n" + ex.reason;
- throw e;
- }
+ try
+ {
+ args = IceUtil::Options::split(value.substr(pos + 1));
+ }
+ catch(const IceUtil::BadOptException& ex)
+ {
+ FailureException e(__FILE__, __LINE__);
+ e.reason = "ServiceManager: invalid arguments for service `" + name + "':\n" + ex.reason;
+ throw e;
+ }
}
start(name, entryPoint, args);
}
@@ -363,148 +363,148 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
//
try
{
- //
- // If Ice.UseSharedCommunicator.<name> is not defined, create
- // a communicator for the service. The communicator inherits
- // from the shared communicator properties. If it's defined
- // add the service properties to the shared commnunicator
- // property set.
- //
- PropertiesPtr properties = _communicator->getProperties();
-
-
- if(properties->getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0)
- {
- PropertiesPtr serviceProperties = createProperties(info.args, properties);
-
- //
- // Erase properties in 'properties'
- //
- PropertyDict allProps = properties->getPropertiesForPrefix("");
- for(PropertyDict::iterator p = allProps.begin(); p != allProps.end(); ++p)
- {
- if(serviceProperties->getProperty(p->first) == "")
- {
- properties->setProperty(p->first, "");
- }
- }
-
- //
- // Put all serviceProperties into 'properties'
- //
- properties->parseCommandLineOptions("", serviceProperties->getCommandLineOptions());
-
- //
- // Parse <service>.* command line options
- // (the Ice command line options were parse by the createProperties above)
- //
- info.args = properties->parseCommandLineOptions(service, info.args);
- }
- else
- {
- string name = properties->getProperty("Ice.ProgramName");
- PropertiesPtr serviceProperties;
- if(properties->getPropertyAsInt("IceBox.InheritContainerProperties") > 0)
- {
- serviceProperties = createProperties(info.args, properties);
- }
- else
- {
- serviceProperties = createProperties(info.args);
- }
-
- if(name == serviceProperties->getProperty("Ice.ProgramName"))
- {
- //
- // If the service did not set its own program-name, and
- // the icebox program-name != service, append the service name to the
- // program name.
- //
- if(name != service)
- {
- name = name.empty() ? service : name + "-" + service;
- }
- serviceProperties->setProperty("Ice.ProgramName", name);
- }
-
- //
- // Parse <service>.* command line options
- // (the Ice command line options were parsed by the createProperties above)
- //
- info.args = serviceProperties->parseCommandLineOptions(service, info.args);
-
- //
- // Remaining command line options are passed to the
- // communicator with argc/argv. This is necessary for Ice
- // plugin properties (e.g.: IceSSL).
- //
- int argc = static_cast<int>(info.args.size());
- char** argv = new char*[argc + 1];
- int i = 0;
- for(Ice::StringSeq::const_iterator p = info.args.begin(); p != info.args.end(); ++p, ++i)
- {
- argv[i] = strdup(p->c_str());
- }
- argv[argc] = 0;
-
- InitializationData initData;
- initData.properties = serviceProperties;
- info.communicator = initialize(argc, argv, initData);
-
- for(i = 0; i < argc + 1; ++i)
- {
- free(argv[i]);
- }
- delete[] argv;
- }
-
- CommunicatorPtr communicator = info.communicator ? info.communicator : _communicator;
-
- //
- // Start the service.
- //
- try
- {
- info.service->start(service, communicator, info.args);
- info.active = true;
- }
- catch(...)
- {
- if(info.communicator)
- {
- try
- {
- info.communicator->shutdown();
- info.communicator->waitForShutdown();
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- //
- // Ignore, the service might have already destroyed
- // the communicator for its own reasons.
- //
- }
- catch(const Ice::Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n";
- out << ex;
- }
-
- try
- {
- info.communicator->destroy();
- info.communicator = 0;
- }
- catch(const Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n";
- out << ex;
- }
- }
- throw;
- }
+ //
+ // If Ice.UseSharedCommunicator.<name> is not defined, create
+ // a communicator for the service. The communicator inherits
+ // from the shared communicator properties. If it's defined
+ // add the service properties to the shared commnunicator
+ // property set.
+ //
+ PropertiesPtr properties = _communicator->getProperties();
+
+
+ if(properties->getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0)
+ {
+ PropertiesPtr serviceProperties = createProperties(info.args, properties);
+
+ //
+ // Erase properties in 'properties'
+ //
+ PropertyDict allProps = properties->getPropertiesForPrefix("");
+ for(PropertyDict::iterator p = allProps.begin(); p != allProps.end(); ++p)
+ {
+ if(serviceProperties->getProperty(p->first) == "")
+ {
+ properties->setProperty(p->first, "");
+ }
+ }
+
+ //
+ // Put all serviceProperties into 'properties'
+ //
+ properties->parseCommandLineOptions("", serviceProperties->getCommandLineOptions());
+
+ //
+ // Parse <service>.* command line options
+ // (the Ice command line options were parse by the createProperties above)
+ //
+ info.args = properties->parseCommandLineOptions(service, info.args);
+ }
+ else
+ {
+ string name = properties->getProperty("Ice.ProgramName");
+ PropertiesPtr serviceProperties;
+ if(properties->getPropertyAsInt("IceBox.InheritContainerProperties") > 0)
+ {
+ serviceProperties = createProperties(info.args, properties);
+ }
+ else
+ {
+ serviceProperties = createProperties(info.args);
+ }
+
+ if(name == serviceProperties->getProperty("Ice.ProgramName"))
+ {
+ //
+ // If the service did not set its own program-name, and
+ // the icebox program-name != service, append the service name to the
+ // program name.
+ //
+ if(name != service)
+ {
+ name = name.empty() ? service : name + "-" + service;
+ }
+ serviceProperties->setProperty("Ice.ProgramName", name);
+ }
+
+ //
+ // Parse <service>.* command line options
+ // (the Ice command line options were parsed by the createProperties above)
+ //
+ info.args = serviceProperties->parseCommandLineOptions(service, info.args);
+
+ //
+ // Remaining command line options are passed to the
+ // communicator with argc/argv. This is necessary for Ice
+ // plugin properties (e.g.: IceSSL).
+ //
+ int argc = static_cast<int>(info.args.size());
+ char** argv = new char*[argc + 1];
+ int i = 0;
+ for(Ice::StringSeq::const_iterator p = info.args.begin(); p != info.args.end(); ++p, ++i)
+ {
+ argv[i] = strdup(p->c_str());
+ }
+ argv[argc] = 0;
+
+ InitializationData initData;
+ initData.properties = serviceProperties;
+ info.communicator = initialize(argc, argv, initData);
+
+ for(i = 0; i < argc + 1; ++i)
+ {
+ free(argv[i]);
+ }
+ delete[] argv;
+ }
+
+ CommunicatorPtr communicator = info.communicator ? info.communicator : _communicator;
+
+ //
+ // Start the service.
+ //
+ try
+ {
+ info.service->start(service, communicator, info.args);
+ info.active = true;
+ }
+ catch(...)
+ {
+ if(info.communicator)
+ {
+ try
+ {
+ info.communicator->shutdown();
+ info.communicator->waitForShutdown();
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ //
+ // Ignore, the service might have already destroyed
+ // the communicator for its own reasons.
+ //
+ }
+ catch(const Ice::Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n";
+ out << ex;
+ }
+
+ try
+ {
+ info.communicator->destroy();
+ info.communicator = 0;
+ }
+ catch(const Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n";
+ out << ex;
+ }
+ }
+ throw;
+ }
info.library = library;
_services.push_back(info);
@@ -515,12 +515,12 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
}
catch(const Exception& ex)
{
- ostringstream s;
- s << "ServiceManager: exception while starting service " << service << ":\n";
- s << ex;
+ ostringstream s;
+ s << "ServiceManager: exception while starting service " << service << ":\n";
+ s << ex;
- FailureException e(__FILE__, __LINE__);
- e.reason = s.str();
+ FailureException e(__FILE__, __LINE__);
+ e.reason = s.str();
throw e;
}
}
@@ -541,103 +541,103 @@ IceBox::ServiceManagerI::stopAll()
//
for(p = _services.rbegin(); p != _services.rend(); ++p)
{
- ServiceInfo& info = *p;
- try
- {
- info.service->stop();
- info.active = false;
- }
- catch(const Ice::Exception& ex)
- {
+ ServiceInfo& info = *p;
+ try
+ {
+ info.service->stop();
+ info.active = false;
+ }
+ catch(const Ice::Exception& ex)
+ {
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << info.name;
- }
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
+ }
}
for(p = _services.rbegin(); p != _services.rend(); ++p)
{
- ServiceInfo& info = *p;
-
- if(info.communicator)
- {
- try
- {
- info.communicator->shutdown();
- info.communicator->waitForShutdown();
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- //
- // Ignore, the service might have already destroyed
- // the communicator for its own reasons.
- //
- }
- catch(const Ice::Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- }
-
- //
- // Release the service, the service communicator and then the library. The order is important,
- // the service must be released before destroying the communicator so that the communicator
- // leak detector doesn't report potential leaks, and the communicator must be destroyed before
- // the library is released since the library will destroy its global state.
- //
- try
- {
- info.service = 0;
- }
- catch(const Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ ServiceInfo& info = *p;
+
+ if(info.communicator)
+ {
+ try
+ {
+ info.communicator->shutdown();
+ info.communicator->waitForShutdown();
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ //
+ // Ignore, the service might have already destroyed
+ // the communicator for its own reasons.
+ //
+ }
+ catch(const Ice::Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ }
+
+ //
+ // Release the service, the service communicator and then the library. The order is important,
+ // the service must be released before destroying the communicator so that the communicator
+ // leak detector doesn't report potential leaks, and the communicator must be destroyed before
+ // the library is released since the library will destroy its global state.
+ //
+ try
+ {
+ info.service = 0;
+ }
+ catch(const Exception& ex)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << info.name;
- }
-
- if(info.communicator)
- {
- try
- {
- info.communicator->destroy();
- info.communicator = 0;
- }
- catch(const Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- }
-
- try
- {
- info.library = 0;
- }
- catch(const Exception& ex)
- {
- Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << info.name << ":\n";
- out << ex;
- }
- catch(...)
- {
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << info.name;
- }
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
+ }
+
+ if(info.communicator)
+ {
+ try
+ {
+ info.communicator->destroy();
+ info.communicator = 0;
+ }
+ catch(const Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ }
+
+ try
+ {
+ info.library = 0;
+ }
+ catch(const Exception& ex)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
+ out << ex;
+ }
+ catch(...)
+ {
+ Warning out(_logger);
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
+ }
}
_services.clear();
diff --git a/cpp/src/IceBox/ServiceManagerI.h b/cpp/src/IceBox/ServiceManagerI.h
index 95a12ad6096..5484aa7b3fa 100644
--- a/cpp/src/IceBox/ServiceManagerI.h
+++ b/cpp/src/IceBox/ServiceManagerI.h
@@ -39,10 +39,10 @@ public:
::std::string name;
ServicePtr service;
::IceInternal::DynamicLibraryPtr library;
- ::Ice::CommunicatorPtr communicator;
- ::std::string envName;
- bool active;
- Ice::StringSeq args;
+ ::Ice::CommunicatorPtr communicator;
+ ::std::string envName;
+ bool active;
+ Ice::StringSeq args;
};
bool start();