summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/timeout/TestI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/timeout/TestI.cpp')
-rw-r--r--cpp/test/Ice/timeout/TestI.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/cpp/test/Ice/timeout/TestI.cpp b/cpp/test/Ice/timeout/TestI.cpp
index 01e95bea34c..e97be228af9 100644
--- a/cpp/test/Ice/timeout/TestI.cpp
+++ b/cpp/test/Ice/timeout/TestI.cpp
@@ -26,7 +26,9 @@ public:
virtual void
run()
{
+ cerr << "holdx start: " << IceUtil::Time::now().toDateTime() << endl;
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(_timeout));
+ cerr << "holdx finished: " << IceUtil::Time::now().toDateTime() << endl;
_adapter->activate();
}
@@ -52,17 +54,31 @@ TimeoutI::sleep(Ice::Int to, const Ice::Current& c)
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(to));
}
+ControllerI::ControllerI(const Ice::ObjectAdapterPtr& adapter) : _adapter(adapter)
+{
+}
+
+void
+ControllerI::holdAdapter(Ice::Int to, const Ice::Current&)
+{
+ _adapter->hold();
+
+ if(to >= 0)
+ {
+ IceUtil::ThreadPtr thread = new ActivateAdapterThread(_adapter, to);
+ IceUtil::ThreadControl threadControl = thread->start();
+ threadControl.detach();
+ }
+}
+
void
-TimeoutI::holdAdapter(Ice::Int to, const Ice::Current& current)
+ControllerI::resumeAdapter(const Ice::Current&)
{
- current.adapter->hold();
- IceUtil::ThreadPtr thread = new ActivateAdapterThread(current.adapter, to);
- IceUtil::ThreadControl threadControl = thread->start();
- threadControl.detach();
+ _adapter->activate();
}
void
-TimeoutI::shutdown(const Ice::Current& current)
+ControllerI::shutdown(const Ice::Current&)
{
- current.adapter->getCommunicator()->shutdown();
+ _adapter->getCommunicator()->shutdown();
}