summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-12-03 15:42:10 -0500
committerBernard Normier <bernard@zeroc.com>2007-12-03 15:42:10 -0500
commit0484d0274b1f47cd0704ee1e5af06b36a355da7c (patch)
tree7270460ed3fa1cc31a5beabc04c8de031ab37b2a /cpp/src
parent- Changed AdminI server start/stop methods to use AMI/AMD (diff)
downloadice-0484d0274b1f47cd0704ee1e5af06b36a355da7c.tar.bz2
ice-0484d0274b1f47cd0704ee1e5af06b36a355da7c.tar.xz
ice-0484d0274b1f47cd0704ee1e5af06b36a355da7c.zip
Fixed bug 1775 (service manager issues)
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp80
-rw-r--r--cpp/src/IceBox/ServiceManagerI.h4
2 files changed, 31 insertions, 53 deletions
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index 88ee6a99ed4..7b5c92c9161 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -144,7 +144,9 @@ IceBox::ServiceManagerI::startService(const string& name, const Current&)
{
vector<string> services;
services.push_back(name);
- servicesStarted(services);
+ set<ServiceObserverPrx> observers = _observers;
+ lock.release();
+ servicesStarted(services, observers);
}
return;
@@ -195,7 +197,9 @@ IceBox::ServiceManagerI::stopService(const string& name, const Current&)
{
vector<string> services;
services.push_back(name);
- servicesStopped(services);
+ set<ServiceObserverPrx> observers = _observers;
+ lock.release();
+ servicesStopped(services, observers);
}
return;
@@ -234,21 +238,9 @@ IceBox::ServiceManagerI::addObserver(const ServiceObserverPrx& observer, const I
if(activeServices.size() > 0)
{
- try
- {
- observer->servicesStarted_async(new AMICallback<AMI_ServiceObserver_servicesStarted>(this, observer),
- activeServices);
- }
- catch(const std::exception& ex)
- {
- _observers.erase(observer);
- observerRemoved(observer, ex);
- }
- catch(...)
- {
- _observers.erase(observer);
- throw;
- }
+ lock.release();
+ observer->servicesStarted_async(new AMICallback<AMI_ServiceObserver_servicesStarted>(this, observer),
+ activeServices);
}
}
}
@@ -759,8 +751,6 @@ IceBox::ServiceManagerI::stopAll()
}
}
- servicesStopped(stoppedServices);
-
for(p = _services.rbegin(); p != _services.rend(); ++p)
{
ServiceInfo& info = *p;
@@ -851,57 +841,45 @@ IceBox::ServiceManagerI::stopAll()
}
_services.clear();
+
+ set<ServiceObserverPrx> observers = _observers;
+ lock.release();
+ servicesStopped(stoppedServices, observers);
}
void
-IceBox::ServiceManagerI::servicesStarted(const vector<string>& services)
+IceBox::ServiceManagerI::servicesStarted(const vector<string>& services, const set<ServiceObserverPrx>& observers)
{
+ //
+ // Must be called with 'this' unlocked
+ //
+
if(services.size() > 0)
{
- //
- // Must be called with 'this' locked
- //
- for(set<ServiceObserverPrx>::iterator p = _observers.begin(); p != _observers.end(); ++p)
+ for(set<ServiceObserverPrx>::const_iterator p = observers.begin(); p != observers.end(); ++p)
{
ServiceObserverPrx observer = *p;
-
- try
- {
- observer->servicesStarted_async(new AMICallback<AMI_ServiceObserver_servicesStarted>(this, observer),
- services);
- }
- catch(const std::exception& ex)
- {
- _observers.erase(p);
- observerRemoved(observer, ex);
- }
+ observer->servicesStarted_async(new AMICallback<AMI_ServiceObserver_servicesStarted>(this, observer),
+ services);
}
}
}
void
-IceBox::ServiceManagerI::servicesStopped(const vector<string>& services)
+IceBox::ServiceManagerI::servicesStopped(const vector<string>& services, const set<ServiceObserverPrx>& observers)
{
+ //
+ // Must be called with 'this' unlocked
+ //
+
if(services.size() > 0)
{
- //
- // Must be called with 'this' locked
- //
- for(set<ServiceObserverPrx>::iterator p = _observers.begin(); p != _observers.end(); ++p)
+ for(set<ServiceObserverPrx>::const_iterator p = observers.begin(); p != observers.end(); ++p)
{
ServiceObserverPrx observer = *p;
-
- try
- {
- observer->servicesStopped_async(new AMICallback<AMI_ServiceObserver_servicesStopped>(this, observer),
- services);
- }
- catch(const std::exception& ex)
- {
- _observers.erase(p);
- observerRemoved(observer, ex);
- }
+ observer->servicesStopped_async(new AMICallback<AMI_ServiceObserver_servicesStopped>(this, observer),
+ services);
}
}
}
diff --git a/cpp/src/IceBox/ServiceManagerI.h b/cpp/src/IceBox/ServiceManagerI.h
index 2b9d7213c80..e4131a82bb0 100644
--- a/cpp/src/IceBox/ServiceManagerI.h
+++ b/cpp/src/IceBox/ServiceManagerI.h
@@ -59,8 +59,8 @@ private:
void start(const std::string&, const std::string&, const ::Ice::StringSeq&);
void stopAll();
- void servicesStarted(const std::vector<std::string>&);
- void servicesStopped(const std::vector<std::string>&);
+ void servicesStarted(const std::vector<std::string>&, const std::set<ServiceObserverPrx>&);
+ void servicesStopped(const std::vector<std::string>&, const std::set<ServiceObserverPrx>&);
void observerRemoved(const ServiceObserverPrx&, const std::exception&);
::Ice::CommunicatorPtr _communicator;