summaryrefslogtreecommitdiff
path: root/cpp/src/IceBox/ServiceManagerI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2012-10-16 12:15:14 +0200
committerBenoit Foucher <benoit@zeroc.com>2012-10-16 12:15:14 +0200
commit1edb603754a8ab3922a3b9b8c69e0dd3614e0dab (patch)
treed5d56c91a42187cbd68b0dcf65e95eab68cde22d /cpp/src/IceBox/ServiceManagerI.cpp
parentICE-4856 - Fix multicast for JDK 7 (diff)
downloadice-1edb603754a8ab3922a3b9b8c69e0dd3614e0dab.tar.bz2
ice-1edb603754a8ab3922a3b9b8c69e0dd3614e0dab.tar.xz
ice-1edb603754a8ab3922a3b9b8c69e0dd3614e0dab.zip
Fixed IceMX race condition, VC9 build
Diffstat (limited to 'cpp/src/IceBox/ServiceManagerI.cpp')
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index 9e502517686..2e04b637793 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -557,11 +557,10 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
{
assert(_sharedCommunicator);
communicator = _sharedCommunicator;
- IceInternal::CommunicatorObserverIPtr o =
- IceInternal::CommunicatorObserverIPtr::dynamicCast(communicator->getObserver());
+ Ice::Instrumentation::CommunicatorObserverPtr o = communicator->getObserver();
if(o)
{
- metricsAdmin = o->getMetricsAdmin();
+ metricsAdmin = IceInternal::CommunicatorObserverIPtr::dynamicCast(o)->getMetricsAdmin();
}
}
else
@@ -754,6 +753,19 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
// Ignored
}
+ try
+ {
+ Ice::ObjectPtr admin = _communicator->removeAdminFacet("IceBox.Service." + info.name + ".MetricsAdmin");
+ if(admin && communicator != _sharedCommunicator)
+ {
+ IceInternal::MetricsAdminIPtr::dynamicCast(admin)->destroy();
+ }
+ }
+ catch(const LocalException&)
+ {
+ // Ignored
+ }
+
if(info.communicator)
{
destroyServiceCommunicator(info.name, info.communicator);
@@ -824,6 +836,19 @@ IceBox::ServiceManagerI::stopAll()
{
// Ignored
}
+
+ try
+ {
+ Ice::ObjectPtr admin = _communicator->removeAdminFacet("IceBox.Service." + info.name + ".MetricsAdmin");
+ if(admin && info.communicator != _sharedCommunicator)
+ {
+ IceInternal::MetricsAdminIPtr::dynamicCast(admin)->destroy();
+ }
+ }
+ catch(const LocalException&)
+ {
+ // Ignored
+ }
if(info.communicator)
{
@@ -903,6 +928,12 @@ IceBox::ServiceManagerI::stopAll()
if(_sharedCommunicator)
{
+ Ice::Instrumentation::CommunicatorObserverPtr o = _sharedCommunicator->getObserver();
+ if(o)
+ {
+ IceInternal::CommunicatorObserverIPtr::dynamicCast(o)->getMetricsAdmin()->destroy();
+ }
+
try
{
_sharedCommunicator->destroy();