summaryrefslogtreecommitdiff
path: root/cpp/src/IceBox/ServiceManagerI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-03-06 20:22:24 +0100
committerBenoit Foucher <benoit@zeroc.com>2008-03-06 20:22:24 +0100
commitd9f98281c0f45dac197280c9b2fed7bcb4d443a9 (patch)
tree747baa2face3b6f264a3959569d5bb8004b997b8 /cpp/src/IceBox/ServiceManagerI.cpp
parentmore PHP docu fixes (diff)
downloadice-d9f98281c0f45dac197280c9b2fed7bcb4d443a9.tar.bz2
ice-d9f98281c0f45dac197280c9b2fed7bcb4d443a9.tar.xz
ice-d9f98281c0f45dac197280c9b2fed7bcb4d443a9.zip
Fixed bug 2740 (again), IceBox observers fixes
Diffstat (limited to 'cpp/src/IceBox/ServiceManagerI.cpp')
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp39
1 files changed, 9 insertions, 30 deletions
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index 0d8710fb6cf..691dc574089 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -154,7 +154,6 @@ IceBox::ServiceManagerI::startService(const string& name, const Current&)
out << "ServiceManager: unknown exception in start for service " << info.name;
}
- set<ServiceObserverPrx> observers;
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
@@ -166,7 +165,10 @@ IceBox::ServiceManagerI::startService(const string& name, const Current&)
if(started)
{
p->status = Started;
- observers = _observers;
+
+ vector<string> services;
+ services.push_back(name);
+ servicesStarted(services, _observers);
}
else
{
@@ -178,13 +180,6 @@ IceBox::ServiceManagerI::startService(const string& name, const Current&)
_pendingStatusChanges = false;
notifyAll();
}
-
- if(observers.size() != 0)
- {
- vector<string> services;
- services.push_back(name);
- servicesStarted(services, observers);
- }
}
void
@@ -237,7 +232,6 @@ IceBox::ServiceManagerI::stopService(const string& name, const Current&)
out << "ServiceManager: unknown exception in stop for service " << info.name;
}
- set<ServiceObserverPrx> observers;
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
@@ -249,7 +243,10 @@ IceBox::ServiceManagerI::stopService(const string& name, const Current&)
if(stopped)
{
p->status = Stopped;
- observers = _observers;
+
+ vector<string> services;
+ services.push_back(name);
+ servicesStopped(services, _observers);
}
else
{
@@ -261,13 +258,6 @@ IceBox::ServiceManagerI::stopService(const string& name, const Current&)
_pendingStatusChanges = false;
notifyAll();
}
-
- if(observers.size() != 0)
- {
- vector<string> services;
- services.push_back(name);
- servicesStopped(services, observers);
- }
}
@@ -299,7 +289,6 @@ IceBox::ServiceManagerI::addObserver(const ServiceObserverPrx& observer, const I
if(activeServices.size() > 0)
{
- lock.release();
observer->servicesStarted_async(new AMICallback<AMI_ServiceObserver_servicesStarted>(this, observer),
activeServices);
}
@@ -857,19 +846,13 @@ IceBox::ServiceManagerI::stopAll()
_services.clear();
- set<ServiceObserverPrx> observers = _observers;
- lock.release();
- servicesStopped(stoppedServices, observers);
+ servicesStopped(stoppedServices, _observers);
}
void
IceBox::ServiceManagerI::servicesStarted(const vector<string>& services, const set<ServiceObserverPrx>& observers)
{
- //
- // Must be called with 'this' unlocked
- //
-
if(services.size() > 0)
{
for(set<ServiceObserverPrx>::const_iterator p = observers.begin(); p != observers.end(); ++p)
@@ -884,10 +867,6 @@ IceBox::ServiceManagerI::servicesStarted(const vector<string>& services, const s
void
IceBox::ServiceManagerI::servicesStopped(const vector<string>& services, const set<ServiceObserverPrx>& observers)
{
- //
- // Must be called with 'this' unlocked
- //
-
if(services.size() > 0)
{
for(set<ServiceObserverPrx>::const_iterator p = observers.begin(); p != observers.end(); ++p)