summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/AdminI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceGrid/AdminI.cpp')
-rw-r--r--cpp/src/IceGrid/AdminI.cpp137
1 files changed, 76 insertions, 61 deletions
diff --git a/cpp/src/IceGrid/AdminI.cpp b/cpp/src/IceGrid/AdminI.cpp
index 5c832e4f4a5..7453a93902b 100644
--- a/cpp/src/IceGrid/AdminI.cpp
+++ b/cpp/src/IceGrid/AdminI.cpp
@@ -394,100 +394,115 @@ AdminI::getServerAdmin(const string& id, const Current& current) const
return current.adapter->createProxy(adminId);
}
-void
-AdminI::startServer_async(const AMD_Admin_startServerPtr& amdCB, const string& id, const Current&)
+namespace
{
- ServerProxyWrapper proxy(_database, id);
- proxy.useActivationTimeout();
- class StartCB : public AMI_Server_start
+class StartCB : virtual public IceUtil::Shared
+{
+public:
+
+ StartCB(const ServerProxyWrapper& proxy, const AMD_Admin_startServerPtr& amdCB) : _proxy(proxy), _amdCB(amdCB)
{
- public:
+ }
- StartCB(const ServerProxyWrapper& proxy, const AMD_Admin_startServerPtr& amdCB) : _proxy(proxy), _amdCB(amdCB)
- {
- }
+ virtual void
+ response()
+ {
+ _amdCB->ice_response();
+ }
- virtual void
- ice_response()
+ virtual void
+ exception(const Ice::Exception& ex)
+ {
+ try
{
- _amdCB->ice_response();
+ _proxy.handleException(ex);
+ assert(false);
}
-
- virtual void
- ice_exception(const Ice::Exception& ex)
+ catch(const Ice::Exception& ex)
{
- try
- {
- _proxy.handleException(ex);
- assert(false);
- }
- catch(const Ice::Exception& ex)
- {
- _amdCB->ice_exception(ex);
- }
+ _amdCB->ice_exception(ex);
}
+ }
- private:
+private:
+
+ const ServerProxyWrapper _proxy;
+ const AMD_Admin_startServerPtr _amdCB;
+};
+
+}
+
+
+void
+AdminI::startServer_async(const AMD_Admin_startServerPtr& amdCB, const string& id, const Current&)
+{
+ ServerProxyWrapper proxy(_database, id);
+ proxy.useActivationTimeout();
- const ServerProxyWrapper _proxy;
- const AMD_Admin_startServerPtr _amdCB;
- };
-
//
// Since the server might take a while to be activated, we use AMI.
//
- proxy->start_async(new StartCB(proxy, amdCB));
+ proxy->begin_start(newCallback_Server_start(new StartCB(proxy, amdCB),
+ &StartCB::response,
+ &StartCB::exception));
}
-void
-AdminI::stopServer_async(const AMD_Admin_stopServerPtr& amdCB, const string& id, const Current&)
+namespace
{
- ServerProxyWrapper proxy(_database, id);
- proxy.useDeactivationTimeout();
- class StopCB : public AMI_Server_stop
+class StopCB : virtual public IceUtil::Shared
+{
+public:
+
+ StopCB(const ServerProxyWrapper& proxy, const AMD_Admin_stopServerPtr& amdCB) : _proxy(proxy), _amdCB(amdCB)
+ {
+ }
+
+ virtual void
+ response()
{
- public:
+ _amdCB->ice_response();
+ }
- StopCB(const ServerProxyWrapper& proxy, const AMD_Admin_stopServerPtr& amdCB) : _proxy(proxy), _amdCB(amdCB)
+ virtual void
+ exception(const Ice::Exception& ex)
+ {
+ try
{
+ _proxy.handleException(ex);
+ assert(false);
}
-
- virtual void
- ice_response()
+ catch(const Ice::TimeoutException&)
{
_amdCB->ice_response();
}
-
- virtual void
- ice_exception(const Ice::Exception& ex)
+ catch(const Ice::Exception& ex)
{
- try
- {
- _proxy.handleException(ex);
- assert(false);
- }
- catch(const Ice::TimeoutException&)
- {
- _amdCB->ice_response();
- }
- catch(const Ice::Exception& ex)
- {
- _amdCB->ice_exception(ex);
- }
+ _amdCB->ice_exception(ex);
}
+ }
- private:
+private:
- const ServerProxyWrapper _proxy;
- const AMD_Admin_stopServerPtr _amdCB;
- };
+ const ServerProxyWrapper _proxy;
+ const AMD_Admin_stopServerPtr _amdCB;
+};
+
+}
+
+void
+AdminI::stopServer_async(const AMD_Admin_stopServerPtr& amdCB, const string& id, const Current&)
+{
+ ServerProxyWrapper proxy(_database, id);
+ proxy.useDeactivationTimeout();
//
// Since the server might take a while to be deactivated, we use AMI.
//
- proxy->stop_async(new StopCB(proxy, amdCB));
+ proxy->begin_stop(newCallback_Server_stop(new StopCB(proxy, amdCB),
+ &StopCB::response,
+ &StopCB::exception));
}
void