summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/Activator.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2012-08-14 00:05:17 +0200
committerJose <jose@zeroc.com>2012-08-14 00:05:17 +0200
commitb3a890faf5841289df3299bac6ada7120b324c16 (patch)
treeeacdb167a4d1e6310bfd49827f90fb2ddf2c144a /cpp/src/IceGrid/Activator.cpp
parentmissing filter properties (diff)
downloadice-b3a890faf5841289df3299bac6ada7120b324c16.tar.bz2
ice-b3a890faf5841289df3299bac6ada7120b324c16.tar.xz
ice-b3a890faf5841289df3299bac6ada7120b324c16.zip
ICE-4809 - AMI metadata in Ice services internal definitions
Diffstat (limited to 'cpp/src/IceGrid/Activator.cpp')
-rw-r--r--cpp/src/IceGrid/Activator.cpp76
1 files changed, 36 insertions, 40 deletions
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp
index 628978b6488..10d0f20d66b 100644
--- a/cpp/src/IceGrid/Activator.cpp
+++ b/cpp/src/IceGrid/Activator.cpp
@@ -786,6 +786,40 @@ Activator::activate(const string& name,
#endif
}
+namespace
+{
+
+class ShutdownCallback : public IceUtil::Shared
+{
+public:
+
+ ShutdownCallback(const ActivatorPtr& activator, const string& name, const TraceLevelsPtr& traceLevels) :
+ _activator(activator), _name(name), _traceLevels(traceLevels)
+ {
+
+ }
+
+ virtual void
+ exception(const Ice::Exception& ex)
+ {
+ Ice::Warning out(_traceLevels->logger);
+ out << "exception occurred while deactivating `" << _name << "' using process proxy:\n" << ex;
+
+ //
+ // Send a SIGTERM to the process.
+ //
+ _activator->sendSignal(_name, SIGTERM);
+ }
+
+private:
+
+ const ActivatorPtr _activator;
+ const string _name;
+ const TraceLevelsPtr _traceLevels;
+};
+
+}
+
void
Activator::deactivate(const string& name, const Ice::ProcessPrx& process)
{
@@ -800,44 +834,6 @@ Activator::deactivate(const string& name, const Ice::ProcessPrx& process)
}
#endif
- class ShutdownCallback : public Ice::AMI_Process_shutdown
- {
- public:
-
- ShutdownCallback(const ActivatorPtr& activator, const string& name, const TraceLevelsPtr& traceLevels) :
- _activator(activator), _name(name), _traceLevels(traceLevels)
- {
-
- }
-
- virtual void
- ice_response()
- {
- //
- // Nothing to do, server successfully shutdown, the activator will detect it
- // once the pipe is closed.
- //
- }
-
- virtual void
- ice_exception(const Ice::Exception& ex)
- {
- Ice::Warning out(_traceLevels->logger);
- out << "exception occurred while deactivating `" << _name << "' using process proxy:\n" << ex;
-
- //
- // Send a SIGTERM to the process.
- //
- _activator->sendSignal(_name, SIGTERM);
- }
-
- private:
-
- const ActivatorPtr _activator;
- const string _name;
- const TraceLevelsPtr _traceLevels;
- };
-
//
// Try to shut down the server gracefully using the process proxy.
//
@@ -848,8 +844,8 @@ Activator::deactivate(const string& name, const Ice::ProcessPrx& process)
Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat);
out << "deactivating `" << name << "' using process proxy";
}
-
- process->shutdown_async(new ShutdownCallback(this, name, _traceLevels));
+ process->begin_shutdown(Ice::newCallback_Process_shutdown(new ShutdownCallback(this, name, _traceLevels),
+ &ShutdownCallback::exception));
return;
}