summaryrefslogtreecommitdiff
path: root/cpp/src/IceBox/ServiceManagerI.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-11-15 18:14:47 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-11-15 18:14:47 +0000
commit9a7a08920a85b7cd16aff5ef5122e4f5a5cc1268 (patch)
treef134c6268db336e2093838ac13f8e497e2ff01ea /cpp/src/IceBox/ServiceManagerI.cpp
parentBug 1547 (diff)
downloadice-9a7a08920a85b7cd16aff5ef5122e4f5a5cc1268.tar.bz2
ice-9a7a08920a85b7cd16aff5ef5122e4f5a5cc1268.tar.xz
ice-9a7a08920a85b7cd16aff5ef5122e4f5a5cc1268.zip
stop order is now reverse of start order
Diffstat (limited to 'cpp/src/IceBox/ServiceManagerI.cpp')
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index ee010e18f05..7ae49c2e7e4 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -251,6 +251,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
//
SERVICE_FACTORY factory = (SERVICE_FACTORY)sym;
ServiceInfo info;
+ info.name = service;
try
{
info.service = factory(_communicator);
@@ -406,8 +407,9 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
throw;
}
+cout << "Starting " << info.name << endl;
info.library = library;
- _services[service] = info;
+ _services.push_back(info);
}
catch(const FailureException&)
{
@@ -428,15 +430,19 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
void
IceBox::ServiceManagerI::stopAll()
{
- map<string,ServiceInfo>::iterator p;
+ //
+ // Services are stopped in the reverse order from which they are started.
+ //
+ vector<ServiceInfo>::reverse_iterator p;
//
// First, for each service, we call stop on the service and flush its database environment to
// the disk.
//
- for(p = _services.begin(); p != _services.end(); ++p)
+ for(p = _services.rbegin(); p != _services.rend(); ++p)
{
- ServiceInfo& info = p->second;
+ ServiceInfo& info = *p;
+cout << "Stopping " << info.name << endl;
try
{
info.service->stop();
@@ -444,19 +450,19 @@ IceBox::ServiceManagerI::stopAll()
catch(const Ice::Exception& ex)
{
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << p->first << ":\n";
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
out << ex;
}
catch(...)
{
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << p->first;
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
}
}
- for(p = _services.begin(); p != _services.end(); ++p)
+ for(p = _services.rbegin(); p != _services.rend(); ++p)
{
- ServiceInfo& info = p->second;
+ ServiceInfo& info = *p;
if(info.communicator)
{
@@ -475,7 +481,7 @@ IceBox::ServiceManagerI::stopAll()
catch(const Ice::Exception& ex)
{
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << p->first << ":\n";
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
out << ex;
}
}
@@ -493,13 +499,13 @@ IceBox::ServiceManagerI::stopAll()
catch(const Exception& ex)
{
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << p->first << ":\n";
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
out << ex;
}
catch(...)
{
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << p->first;
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
}
if(info.communicator)
@@ -512,7 +518,7 @@ IceBox::ServiceManagerI::stopAll()
catch(const Exception& ex)
{
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << p->first << ":\n";
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
out << ex;
}
}
@@ -524,13 +530,13 @@ IceBox::ServiceManagerI::stopAll()
catch(const Exception& ex)
{
Warning out(_logger);
- out << "ServiceManager: exception in stop for service " << p->first << ":\n";
+ out << "ServiceManager: exception in stop for service " << info.name << ":\n";
out << ex;
}
catch(...)
{
Warning out(_logger);
- out << "ServiceManager: unknown exception in stop for service " << p->first;
+ out << "ServiceManager: unknown exception in stop for service " << info.name;
}
}