summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/timeout/TestI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-09-15 12:18:41 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-09-15 12:18:41 +0200
commita4fb9c391caabef6de9cfbd126f4fe10755ece49 (patch)
tree36dfe5b0a110dddd09f49882649d8c2de825f4b4 /cpp/test/Ice/timeout/TestI.cpp
parentRemoved Eclipse .launch files (diff)
downloadice-a4fb9c391caabef6de9cfbd126f4fe10755ece49.tar.bz2
ice-a4fb9c391caabef6de9cfbd126f4fe10755ece49.tar.xz
ice-a4fb9c391caabef6de9cfbd126f4fe10755ece49.zip
Fixed timeout tests to be less time sensitive
The tests now use a controller to hold/activate the adapter instead of relying on a timer. Fixes ICE-8312.
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();
}