summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/test/Ice/timeout/AllTests.cpp81
-rw-r--r--cpp/test/Ice/timeout/Client.cpp5
-rw-r--r--cpp/test/Ice/timeout/Server.cpp11
-rw-r--r--cpp/test/Ice/timeout/Test.ice5
-rw-r--r--cpp/test/Ice/timeout/TestI.cpp30
-rw-r--r--cpp/test/Ice/timeout/TestI.h13
-rw-r--r--csharp/test/Ice/timeout/AllTests.cs80
-rw-r--r--csharp/test/Ice/timeout/Client.cs3
-rw-r--r--csharp/test/Ice/timeout/Server.cs7
-rw-r--r--csharp/test/Ice/timeout/Test.ice5
-rw-r--r--csharp/test/Ice/timeout/TestI.cs (renamed from csharp/test/Ice/timeout/TimeoutI.cs)28
-rw-r--r--csharp/test/Ice/timeout/msbuild/client/client.csproj4
-rw-r--r--csharp/test/Ice/timeout/msbuild/server/server.csproj4
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/AllTests.java90
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/Client.java3
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/Server.java9
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/Test.ice5
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java43
-rw-r--r--java/test/src/main/java/test/Ice/timeout/AllTests.java92
-rw-r--r--java/test/src/main/java/test/Ice/timeout/Client.java3
-rw-r--r--java/test/src/main/java/test/Ice/timeout/Server.java9
-rw-r--r--java/test/src/main/java/test/Ice/timeout/Test.ice5
-rw-r--r--java/test/src/main/java/test/Ice/timeout/TimeoutI.java40
-rw-r--r--js/test/Ice/timeout/Client.js75
-rw-r--r--js/test/Ice/timeout/Test.ice5
-rw-r--r--objective-c/test/Ice/timeout/AllTests.m50
-rw-r--r--objective-c/test/Ice/timeout/Client.m5
-rw-r--r--objective-c/test/Ice/timeout/Server.m12
-rw-r--r--objective-c/test/Ice/timeout/TestI.h8
-rw-r--r--objective-c/test/Ice/timeout/TestI.m45
-rw-r--r--objective-c/test/Ice/timeout/TimeoutTest.ice5
-rw-r--r--php/test/Ice/timeout/Client.php74
-rw-r--r--php/test/Ice/timeout/Test.ice5
-rw-r--r--python/test/Ice/timeout/AllTests.py69
-rwxr-xr-xpython/test/Ice/timeout/Client.py4
-rwxr-xr-xpython/test/Ice/timeout/Server.py23
-rw-r--r--python/test/Ice/timeout/Test.ice5
-rw-r--r--ruby/test/Ice/timeout/AllTests.rb66
-rwxr-xr-xruby/test/Ice/timeout/Client.rb4
-rw-r--r--ruby/test/Ice/timeout/Test.ice5
40 files changed, 641 insertions, 394 deletions
diff --git a/cpp/test/Ice/timeout/AllTests.cpp b/cpp/test/Ice/timeout/AllTests.cpp
index 4bc13e1df8a..8834e76aed7 100644
--- a/cpp/test/Ice/timeout/AllTests.cpp
+++ b/cpp/test/Ice/timeout/AllTests.cpp
@@ -110,7 +110,7 @@ connect(const Ice::ObjectPrxPtr& prx)
}
-TimeoutPrxPtr
+void
allTests(const Ice::CommunicatorPtr& communicator)
{
string sref = "timeout:" + getTestEndpoint(communicator, 0);
@@ -120,13 +120,17 @@ allTests(const Ice::CommunicatorPtr& communicator)
TimeoutPrxPtr timeout = ICE_CHECKED_CAST(TimeoutPrx, obj);
test(timeout);
+ ControllerPrxPtr controller =
+ ICE_CHECKED_CAST(ControllerPrx, communicator->stringToProxy("controller:" + getTestEndpoint(communicator, 1)));
+ test(controller);
+
cout << "testing connect timeout... " << flush;
{
//
// Expect ConnectTimeoutException.
//
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(100));
- timeout->holdAdapter(500);
+ controller->holdAdapter(-1);
try
{
to->op();
@@ -136,14 +140,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
// Expected.
}
+ controller->resumeAdapter();
+ timeout->op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- timeout->op(); // Ensure adapter is active.
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(1000));
- timeout->holdAdapter(500);
+ controller->holdAdapter(200);
try
{
to->op();
@@ -165,7 +170,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
//
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(250));
connect(to);
- timeout->holdAdapter(750);
+ controller->holdAdapter(-1);
try
{
to->sendData(seq);
@@ -175,14 +180,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
// Expected.
}
+ controller->resumeAdapter();
+ timeout->op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- timeout->op(); // Ensure adapter is active.
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(1000));
- timeout->holdAdapter(500);
+ controller->holdAdapter(200);
try
{
ByteSeq seq(1000000);
@@ -202,7 +208,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(connection == to->ice_getConnection());
try
{
- to->sleep(750);
+ to->sleep(500);
test(false);
}
catch(const Ice::InvocationTimeoutException&)
@@ -228,7 +234,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_invocationTimeout(100));
#ifdef ICE_CPP11_MAPPING
- auto f = to->sleepAsync(750);
+ auto f = to->sleepAsync(500);
try
{
f.get();
@@ -243,7 +249,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
}
#else
CallbackPtr cb = new Callback();
- to->begin_sleep(750, newCallback_Timeout_sleep(cb, &Callback::responseEx, &Callback::exceptionEx));
+ to->begin_sleep(500, newCallback_Timeout_sleep(cb, &Callback::responseEx, &Callback::exceptionEx));
cb->check();
#endif
obj->ice_ping();
@@ -323,7 +329,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, obj->ice_timeout(250));
Ice::ConnectionPtr connection = connect(to);
- timeout->holdAdapter(600);
+ controller->holdAdapter(-1);
connection->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait));
try
{
@@ -333,17 +339,21 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
test(false);
}
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(650));
- try
- {
- connection->getInfo();
- test(false);
- }
- catch(const Ice::ConnectionManuallyClosedException& ex)
+ while(true)
{
- // Expected.
- test(ex.graceful);
+ try
+ {
+ connection->getInfo();
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(10));
+ }
+ catch(const Ice::ConnectionManuallyClosedException& ex)
+ {
+ // Expected.
+ test(ex.graceful);
+ break;
+ }
}
+ controller->resumeAdapter();
timeout->op(); // Ensure adapter is active.
}
cout << "ok" << endl;
@@ -361,7 +371,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
Ice::CommunicatorHolder ich(initData);
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, ich->stringToProxy(sref));
connect(to);
- timeout->holdAdapter(500);
+ controller->holdAdapter(-1);
try
{
to->sendData(seq);
@@ -371,14 +381,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
// Expected.
}
+ controller->resumeAdapter();
+ timeout->op(); // Ensure adapter is active.
//
// Calling ice_timeout() should have no effect.
//
- timeout->op(); // Ensure adapter is active.
to = ICE_UNCHECKED_CAST(TimeoutPrx, to->ice_timeout(1000));
connect(to);
- timeout->holdAdapter(500);
+ controller->holdAdapter(-1);
try
{
to->sendData(seq);
@@ -388,6 +399,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
// Expected.
}
+ controller->resumeAdapter();
+ timeout->op(); // Ensure adapter is active.
}
{
//
@@ -397,7 +410,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
initData.properties = communicator->getProperties()->clone();
initData.properties->setProperty("Ice.Override.ConnectTimeout", "250");
Ice::CommunicatorHolder ich(initData);
- timeout->holdAdapter(750);
+ controller->holdAdapter(-1);
TimeoutPrxPtr to = ICE_UNCHECKED_CAST(TimeoutPrx, ich->stringToProxy(sref));
try
{
@@ -408,11 +421,13 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
// Expected.
}
+ controller->resumeAdapter();
+ timeout->op(); // Ensure adapter is active.
+
//
// Calling ice_timeout() should have no effect on the connect timeout.
//
- timeout->op(); // Ensure adapter is active.
- timeout->holdAdapter(750);
+ controller->holdAdapter(-1);
to = ICE_UNCHECKED_CAST(TimeoutPrx, to->ice_timeout(1000));
try
{
@@ -423,13 +438,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
// Expected.
}
+ controller->resumeAdapter();
+ timeout->op(); // Ensure adapter is active.
+
//
// Verify that timeout set via ice_timeout() is still used for requests.
//
- timeout->op(); // Ensure adapter is active.
to = ICE_UNCHECKED_CAST(TimeoutPrx, to->ice_timeout(250));
connect(to);
- timeout->holdAdapter(750);
+ controller->holdAdapter(-1);
try
{
to->sendData(seq);
@@ -439,6 +456,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
// Expected.
}
+ controller->resumeAdapter();
+ timeout->op(); // Ensure adapter is active.
}
{
//
@@ -449,10 +468,12 @@ allTests(const Ice::CommunicatorPtr& communicator)
initData.properties->setProperty("Ice.Override.CloseTimeout", "100");
Ice::CommunicatorHolder ich(initData);
Ice::ConnectionPtr connection = ich->stringToProxy(sref)->ice_getConnection();
- timeout->holdAdapter(800);
+ controller->holdAdapter(-1);
IceUtil::Time now = IceUtil::Time::now();
ich.release()->destroy();
test(IceUtil::Time::now() - now < IceUtil::Time::milliSeconds(700));
+ controller->resumeAdapter();
+ timeout->op(); // Ensure adapter is active.
}
cout << "ok" << endl;
@@ -548,5 +569,5 @@ allTests(const Ice::CommunicatorPtr& communicator)
}
cout << "ok" << endl;
- return timeout;
+ controller->shutdown();
}
diff --git a/cpp/test/Ice/timeout/Client.cpp b/cpp/test/Ice/timeout/Client.cpp
index 62ddac641b8..fb8d546bd56 100644
--- a/cpp/test/Ice/timeout/Client.cpp
+++ b/cpp/test/Ice/timeout/Client.cpp
@@ -19,9 +19,8 @@ using namespace Test;
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- TimeoutPrxPtr allTests(const Ice::CommunicatorPtr&);
- TimeoutPrxPtr timeout = allTests(communicator);
- timeout->shutdown();
+ void allTests(const Ice::CommunicatorPtr&);
+ allTests(communicator);
return EXIT_SUCCESS;
}
diff --git a/cpp/test/Ice/timeout/Server.cpp b/cpp/test/Ice/timeout/Server.cpp
index 8922a336669..64b08e7cf3c 100644
--- a/cpp/test/Ice/timeout/Server.cpp
+++ b/cpp/test/Ice/timeout/Server.cpp
@@ -19,10 +19,17 @@ int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
+ communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1));
+ communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
- Ice::ObjectPtr object = ICE_MAKE_SHARED(TimeoutI);
- adapter->add(object, Ice::stringToIdentity("timeout"));
+ adapter->add(ICE_MAKE_SHARED(TimeoutI), Ice::stringToIdentity("timeout"));
adapter->activate();
+
+ Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
+ controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
+ controllerAdapter->activate();
+
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
diff --git a/cpp/test/Ice/timeout/Test.ice b/cpp/test/Ice/timeout/Test.ice
index aad831a9993..d611817c1ac 100644
--- a/cpp/test/Ice/timeout/Test.ice
+++ b/cpp/test/Ice/timeout/Test.ice
@@ -19,9 +19,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}
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();
}
diff --git a/cpp/test/Ice/timeout/TestI.h b/cpp/test/Ice/timeout/TestI.h
index 737913beadb..8655aea585a 100644
--- a/cpp/test/Ice/timeout/TestI.h
+++ b/cpp/test/Ice/timeout/TestI.h
@@ -20,8 +20,21 @@ public:
virtual void op(const Ice::Current&);
virtual void sendData(ICE_IN(Test::ByteSeq), const Ice::Current&);
virtual void sleep(Ice::Int, const Ice::Current&);
+};
+
+class ControllerI : public virtual Test::Controller
+{
+public:
+
+ ControllerI(const Ice::ObjectAdapterPtr&);
+
virtual void holdAdapter(Ice::Int, const Ice::Current&);
+ virtual void resumeAdapter(const Ice::Current&);
virtual void shutdown(const Ice::Current&);
+
+private:
+
+ const Ice::ObjectAdapterPtr _adapter;
};
#endif
diff --git a/csharp/test/Ice/timeout/AllTests.cs b/csharp/test/Ice/timeout/AllTests.cs
index d9d1855a651..e54717367b3 100644
--- a/csharp/test/Ice/timeout/AllTests.cs
+++ b/csharp/test/Ice/timeout/AllTests.cs
@@ -63,7 +63,7 @@ public class AllTests : TestCommon.AllTests
return prx.ice_getConnection();
}
- public static Test.TimeoutPrx allTests(TestCommon.Application app)
+ public static void allTests(TestCommon.Application app)
{
Ice.Communicator communicator = app.communicator();
string sref = "timeout:" + app.getTestEndpoint(0);
@@ -73,6 +73,10 @@ public class AllTests : TestCommon.AllTests
Test.TimeoutPrx timeout = Test.TimeoutPrxHelper.checkedCast(obj);
test(timeout != null);
+ Test.ControllerPrx controller = Test.ControllerPrxHelper.checkedCast(
+ communicator.stringToProxy("controller:" + app.getTestEndpoint(1)));
+ test(controller != null);
+
Write("testing connect timeout... ");
Flush();
{
@@ -80,7 +84,7 @@ public class AllTests : TestCommon.AllTests
// Expect ConnectTimeoutException.
//
Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(100));
- timeout.holdAdapter(500);
+ controller.holdAdapter(-1);
try
{
to.op();
@@ -90,14 +94,15 @@ public class AllTests : TestCommon.AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- timeout.op(); // Ensure adapter is active.
Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000));
- timeout.holdAdapter(500);
+ controller.holdAdapter(200);
try
{
to.op();
@@ -120,7 +125,7 @@ public class AllTests : TestCommon.AllTests
//
Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(250));
connect(to);
- timeout.holdAdapter(750);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -130,14 +135,15 @@ public class AllTests : TestCommon.AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- timeout.op(); // Ensure adapter is active.
Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000));
- timeout.holdAdapter(500);
+ controller.holdAdapter(200);
try
{
to.sendData(new byte[1000000]);
@@ -157,7 +163,7 @@ public class AllTests : TestCommon.AllTests
test(connection == to.ice_getConnection());
try
{
- to.sleep(750);
+ to.sleep(500);
test(false);
}
catch(Ice.InvocationTimeoutException)
@@ -182,7 +188,7 @@ public class AllTests : TestCommon.AllTests
//
Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(100));
Callback cb = new Callback();
- to.begin_sleep(750).whenCompleted(
+ to.begin_sleep(500).whenCompleted(
() =>
{
test(false);
@@ -265,7 +271,7 @@ public class AllTests : TestCommon.AllTests
{
Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(250));
Ice.Connection connection = connect(to);
- timeout.holdAdapter(600);
+ controller.holdAdapter(-1);
connection.close(Ice.ConnectionClose.GracefullyWithWait);
try
{
@@ -275,17 +281,21 @@ public class AllTests : TestCommon.AllTests
{
test(false);
}
- Thread.Sleep(650);
- try
- {
- connection.getInfo();
- test(false);
- }
- catch(Ice.ConnectionManuallyClosedException ex)
+ while(true)
{
- // Expected.
- test(ex.graceful);
+ try
+ {
+ connection.getInfo();
+ Thread.Sleep(10);
+ }
+ catch(Ice.ConnectionManuallyClosedException ex)
+ {
+ // Expected.
+ test(ex.graceful);
+ break;
+ }
}
+ controller.resumeAdapter();
timeout.op(); // Ensure adapter is active.
}
WriteLine("ok");
@@ -305,7 +315,7 @@ public class AllTests : TestCommon.AllTests
Ice.Communicator comm = Ice.Util.initialize(ref args, initData);
Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref));
connect(to);
- timeout.holdAdapter(500);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -315,13 +325,15 @@ public class AllTests : TestCommon.AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Calling ice_timeout() should have no effect.
//
- timeout.op(); // Ensure adapter is active.
to = Test.TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1000));
connect(to);
- timeout.holdAdapter(500);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -331,6 +343,8 @@ public class AllTests : TestCommon.AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
comm.destroy();
}
{
@@ -342,7 +356,7 @@ public class AllTests : TestCommon.AllTests
initData.properties = communicator.getProperties().ice_clone_();
initData.properties.setProperty("Ice.Override.ConnectTimeout", "250");
Ice.Communicator comm = Ice.Util.initialize(ref args, initData);
- timeout.holdAdapter(750);
+ controller.holdAdapter(-1);
Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref));
try
{
@@ -353,11 +367,13 @@ public class AllTests : TestCommon.AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Calling ice_timeout() should have no effect on the connect timeout.
//
- timeout.op(); // Ensure adapter is active.
- timeout.holdAdapter(750);
+ controller.holdAdapter(-1);
to = Test.TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1000));
try
{
@@ -368,13 +384,15 @@ public class AllTests : TestCommon.AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Verify that timeout set via ice_timeout() is still used for requests.
//
- timeout.op(); // Ensure adapter is active.
to = Test.TimeoutPrxHelper.uncheckedCast(to.ice_timeout(250));
connect(to);
- timeout.holdAdapter(750);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -384,6 +402,8 @@ public class AllTests : TestCommon.AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
comm.destroy();
}
{
@@ -395,10 +415,11 @@ public class AllTests : TestCommon.AllTests
initData.properties.setProperty("Ice.Override.CloseTimeout", "100");
Ice.Communicator comm = Ice.Util.initialize(initData);
comm.stringToProxy(sref).ice_getConnection();
- timeout.holdAdapter(800);
+ controller.holdAdapter(-1);
long begin = System.DateTime.Now.Ticks;
comm.destroy();
test(((long)new System.TimeSpan(System.DateTime.Now.Ticks - begin).TotalMilliseconds - begin) < 700);
+ controller.resumeAdapter();
}
WriteLine("ok");
@@ -472,6 +493,7 @@ public class AllTests : TestCommon.AllTests
adapter.destroy();
}
WriteLine("ok");
- return timeout;
+
+ controller.shutdown();
}
}
diff --git a/csharp/test/Ice/timeout/Client.cs b/csharp/test/Ice/timeout/Client.cs
index 4d74eb69a40..026a5e4e105 100644
--- a/csharp/test/Ice/timeout/Client.cs
+++ b/csharp/test/Ice/timeout/Client.cs
@@ -20,8 +20,7 @@ public class Client : TestCommon.Application
{
public override int run(string[] args)
{
- Test.TimeoutPrx timeout = AllTests.allTests(this);
- timeout.shutdown();
+ AllTests.allTests(this);
return 0;
}
diff --git a/csharp/test/Ice/timeout/Server.cs b/csharp/test/Ice/timeout/Server.cs
index 1db43419a87..9cb24c03566 100644
--- a/csharp/test/Ice/timeout/Server.cs
+++ b/csharp/test/Ice/timeout/Server.cs
@@ -21,10 +21,17 @@ public class Server : TestCommon.Application
public override int run(string[] args)
{
communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
+ communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new TimeoutI(), Ice.Util.stringToIdentity("timeout"));
adapter.activate();
+ Ice.ObjectAdapter controllerAdapter = communicator().createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
+ controllerAdapter.activate();
+
communicator().waitForShutdown();
return 0;
}
diff --git a/csharp/test/Ice/timeout/Test.ice b/csharp/test/Ice/timeout/Test.ice
index aad831a9993..d611817c1ac 100644
--- a/csharp/test/Ice/timeout/Test.ice
+++ b/csharp/test/Ice/timeout/Test.ice
@@ -19,9 +19,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}
diff --git a/csharp/test/Ice/timeout/TimeoutI.cs b/csharp/test/Ice/timeout/TestI.cs
index 1d786751c74..b9e868d1693 100644
--- a/csharp/test/Ice/timeout/TimeoutI.cs
+++ b/csharp/test/Ice/timeout/TestI.cs
@@ -25,7 +25,7 @@ internal class ActivateAdapterThread
}
private Ice.ObjectAdapter _adapter;
- int _timeout;
+ private int _timeout;
}
internal class TimeoutI : Test.TimeoutDisp_
@@ -42,17 +42,35 @@ internal class TimeoutI : Test.TimeoutDisp_
{
Thread.Sleep(to);
}
+}
+
+internal class ControllerI : Test.ControllerDisp_
+{
+ public ControllerI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ }
public override void holdAdapter(int to, Ice.Current current)
{
- current.adapter.hold();
- ActivateAdapterThread act = new ActivateAdapterThread(current.adapter, to);
- Thread thread = new Thread(new ThreadStart(act.run));
- thread.Start();
+ _adapter.hold();
+ if(to >= 0)
+ {
+ ActivateAdapterThread act = new ActivateAdapterThread(_adapter, to);
+ Thread thread = new Thread(new ThreadStart(act.run));
+ thread.Start();
+ }
+ }
+
+ public override void resumeAdapter(Ice.Current current)
+ {
+ _adapter.activate();
}
public override void shutdown(Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
+
+ private Ice.ObjectAdapter _adapter;
}
diff --git a/csharp/test/Ice/timeout/msbuild/client/client.csproj b/csharp/test/Ice/timeout/msbuild/client/client.csproj
index 763d9cd7896..5cd49215652 100644
--- a/csharp/test/Ice/timeout/msbuild/client/client.csproj
+++ b/csharp/test/Ice/timeout/msbuild/client/client.csproj
@@ -45,8 +45,8 @@
<Compile Include="..\..\Client.cs">
<Link>Client.cs</Link>
</Compile>
- <Compile Include="..\..\TimeoutI.cs">
- <Link>TimeoutI.cs</Link>
+ <Compile Include="..\..\TestI.cs">
+ <Link>TestI.cs</Link>
</Compile>
<Compile Include="generated\Test.cs" />
</ItemGroup>
diff --git a/csharp/test/Ice/timeout/msbuild/server/server.csproj b/csharp/test/Ice/timeout/msbuild/server/server.csproj
index 356adbc6d66..4f42fc25589 100644
--- a/csharp/test/Ice/timeout/msbuild/server/server.csproj
+++ b/csharp/test/Ice/timeout/msbuild/server/server.csproj
@@ -42,8 +42,8 @@
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
- <Compile Include="..\..\TimeoutI.cs">
- <Link>TimeoutI.cs</Link>
+ <Compile Include="..\..\TestI.cs">
+ <Link>TestI.cs</Link>
</Compile>
<Compile Include="generated\Test.cs" />
</ItemGroup>
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java
index 23fc575b9b9..277998ecb00 100644
--- a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java
+++ b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java
@@ -13,6 +13,8 @@ import java.io.PrintWriter;
import test.Ice.timeout.Test.TimeoutPrx;
import test.Ice.timeout.Test.TimeoutPrxHelper;
+import test.Ice.timeout.Test.ControllerPrx;
+import test.Ice.timeout.Test.ControllerPrxHelper;
public class AllTests
{
@@ -151,7 +153,7 @@ public class AllTests
return prx.ice_getConnection(); // Establish connection
}
- public static TimeoutPrx
+ public static void
allTests(test.Util.Application app)
{
Ice.Communicator communicator = app.communicator();
@@ -170,6 +172,10 @@ public class AllTests
TimeoutPrx timeout = TimeoutPrxHelper.checkedCast(obj);
test(timeout != null);
+ ControllerPrx controller = ControllerPrxHelper.checkedCast(
+ communicator.stringToProxy("controller:" + app.getTestEndpoint(1)));
+ test(controller != null);
+
out.print("testing connect timeout... ");
out.flush();
{
@@ -177,7 +183,7 @@ public class AllTests
// Expect ConnectTimeoutException.
//
TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(100 * mult));
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(200 * mult);
try
{
to.op();
@@ -194,7 +200,7 @@ public class AllTests
//
timeout.op(); // Ensure adapter is active.
TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000 * mult));
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(200 * mult);
try
{
to.op();
@@ -218,7 +224,7 @@ public class AllTests
//
TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(250));
connect(to);
- timeout.holdAdapter(750 * mult);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -228,14 +234,15 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- timeout.op(); // Ensure adapter is active.
TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000 * mult));
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(200 * mult);
try
{
to.sendData(new byte[1000000]);
@@ -255,7 +262,7 @@ public class AllTests
test(connection == to.ice_getConnection());
try
{
- to.sleep(750 * mult);
+ to.sleep(500 * mult);
test(false);
}
catch(Ice.InvocationTimeoutException ex)
@@ -280,7 +287,7 @@ public class AllTests
//
TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(100));
CallbackFail cb = new CallbackFail();
- to.begin_sleep(750 * mult, cb);
+ to.begin_sleep(500 * mult, cb);
cb.check();
obj.ice_ping();
}
@@ -347,7 +354,7 @@ public class AllTests
{
TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(250 * mult));
Ice.Connection connection = connect(to);
- timeout.holdAdapter(600);
+ controller.holdAdapter(-1);
connection.close(Ice.ConnectionClose.GracefullyWithWait);
try
{
@@ -357,23 +364,27 @@ public class AllTests
{
test(false);
}
- try
- {
- Thread.sleep(650 * mult);
- }
- catch(java.lang.InterruptedException ex)
+ while(true)
{
+ try
+ {
+ connection.getInfo();
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ catch(Ice.ConnectionManuallyClosedException ex)
+ {
+ // Expected.
+ test(ex.graceful);
+ break;
+ }
}
- try
- {
- connection.getInfo();
- test(false);
- }
- catch(Ice.ConnectionManuallyClosedException ex)
- {
- // Expected.
- test(ex.graceful);
- }
+ controller.resumeAdapter();
timeout.op(); // Ensure adapter is active.
}
out.println("ok");
@@ -392,7 +403,7 @@ public class AllTests
Ice.Communicator comm = app.initialize(initData);
TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref));
connect(to);
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -402,13 +413,15 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Calling ice_timeout() should have no effect.
//
- timeout.op(); // Ensure adapter is active.
to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1000 * mult));
connect(to);
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -418,6 +431,8 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
comm.destroy();
}
{
@@ -437,7 +452,7 @@ public class AllTests
Ice.Communicator comm = app.initialize(initData);
TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref));
- timeout.holdAdapter(750 * mult);
+ controller.holdAdapter(-1);
try
{
to.op();
@@ -447,11 +462,13 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Calling ice_timeout() should have no effect on the connect timeout.
//
- timeout.op(); // Ensure adapter is active.
- timeout.holdAdapter(750 * mult);
+ controller.holdAdapter(-1);
to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1000 * mult));
try
{
@@ -462,13 +479,15 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Verify that timeout set via ice_timeout() is still used for requests.
//
- timeout.op(); // Ensure adapter is active.
to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(250));
connect(to);
- timeout.holdAdapter(750 * mult);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -478,6 +497,8 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
comm.destroy();
}
{
@@ -489,10 +510,11 @@ public class AllTests
initData.properties.setProperty("Ice.Override.CloseTimeout", "100");
Ice.Communicator comm = app.initialize(initData);
comm.stringToProxy(sref).ice_getConnection();
- timeout.holdAdapter(800);
+ controller.holdAdapter(-1);
long now = System.nanoTime();
comm.destroy();
test(System.nanoTime() - now < 700 * 1000000);
+ controller.resumeAdapter();
}
out.println("ok");
@@ -569,6 +591,6 @@ public class AllTests
}
out.println("ok");
- return timeout;
+ controller.shutdown();
}
}
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Client.java b/java-compat/test/src/main/java/test/Ice/timeout/Client.java
index 872ee198bf3..2c5bd1098af 100644
--- a/java-compat/test/src/main/java/test/Ice/timeout/Client.java
+++ b/java-compat/test/src/main/java/test/Ice/timeout/Client.java
@@ -16,8 +16,7 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- TimeoutPrx timeout = AllTests.allTests(this);
- timeout.shutdown();
+ AllTests.allTests(this);
return 0;
}
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Server.java b/java-compat/test/src/main/java/test/Ice/timeout/Server.java
index dcdacd5a222..4e410149643 100644
--- a/java-compat/test/src/main/java/test/Ice/timeout/Server.java
+++ b/java-compat/test/src/main/java/test/Ice/timeout/Server.java
@@ -15,9 +15,15 @@ public class Server extends test.Util.Application
public int run(String[] args)
{
Ice.Communicator communicator = communicator();
+
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new TimeoutI(), Ice.Util.stringToIdentity("timeout"));
adapter.activate();
+
+ Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
+ controllerAdapter.activate();
+
return WAIT;
}
@@ -27,6 +33,9 @@ public class Server extends test.Util.Application
Ice.InitializationData initData = super.getInitData(argsH);
initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout");
initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0));
+ initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1));
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
//
// Limit the recv buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Test.ice b/java-compat/test/src/main/java/test/Ice/timeout/Test.ice
index 93b88a53f06..773e88d88d4 100644
--- a/java-compat/test/src/main/java/test/Ice/timeout/Test.ice
+++ b/java-compat/test/src/main/java/test/Ice/timeout/Test.ice
@@ -20,9 +20,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java b/java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java
index 7f25b2b99f8..466759cd32a 100644
--- a/java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java
+++ b/java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java
@@ -12,33 +12,6 @@ import test.Ice.timeout.Test._TimeoutDisp;
class TimeoutI extends _TimeoutDisp
{
- static class ActivateAdapterThread extends Thread
- {
- ActivateAdapterThread(Ice.ObjectAdapter adapter, int timeout)
- {
- _adapter = adapter;
- _timeout = timeout;
- }
-
- @Override
- public void
- run()
- {
- _adapter.waitForHold();
- try
- {
- sleep(_timeout);
- }
- catch(InterruptedException ex)
- {
- }
- _adapter.activate();
- }
-
- Ice.ObjectAdapter _adapter;
- int _timeout;
- }
-
@Override
public void
op(Ice.Current current)
@@ -64,20 +37,4 @@ class TimeoutI extends _TimeoutDisp
System.err.println("sleep interrupted");
}
}
-
- @Override
- public void
- holdAdapter(int to, Ice.Current current)
- {
- current.adapter.hold();
- Thread thread = new ActivateAdapterThread(current.adapter, to);
- thread.start();
- }
-
- @Override
- public void
- shutdown(Ice.Current current)
- {
- current.adapter.getCommunicator().shutdown();
- }
}
diff --git a/java/test/src/main/java/test/Ice/timeout/AllTests.java b/java/test/src/main/java/test/Ice/timeout/AllTests.java
index d7967a59b1b..531e10d8208 100644
--- a/java/test/src/main/java/test/Ice/timeout/AllTests.java
+++ b/java/test/src/main/java/test/Ice/timeout/AllTests.java
@@ -13,6 +13,7 @@ import java.io.PrintWriter;
import java.util.concurrent.CompletionException;
import test.Ice.timeout.Test.TimeoutPrx;
+import test.Ice.timeout.Test.ControllerPrx;
public class AllTests
{
@@ -75,7 +76,7 @@ public class AllTests
return prx.ice_getConnection(); // Establish connection
}
- public static TimeoutPrx allTests(test.Util.Application app)
+ public static void allTests(test.Util.Application app)
{
com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
@@ -93,6 +94,10 @@ public class AllTests
TimeoutPrx timeout = TimeoutPrx.checkedCast(obj);
test(timeout != null);
+ ControllerPrx controller = ControllerPrx.checkedCast(
+ communicator.stringToProxy("controller:" + app.getTestEndpoint(1)));
+ test(controller != null);
+
out.print("testing connect timeout... ");
out.flush();
{
@@ -100,7 +105,7 @@ public class AllTests
// Expect ConnectTimeoutException.
//
TimeoutPrx to = timeout.ice_timeout(100 * mult);
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(-1);
try
{
to.op();
@@ -110,14 +115,15 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- timeout.op(); // Ensure adapter is active.
TimeoutPrx to = timeout.ice_timeout(1000 * mult);
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(200 * mult);
try
{
to.op();
@@ -141,7 +147,7 @@ public class AllTests
//
TimeoutPrx to = timeout.ice_timeout(250);
connect(to);
- timeout.holdAdapter(750 * mult);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -151,14 +157,15 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- timeout.op(); // Ensure adapter is active.
TimeoutPrx to = timeout.ice_timeout(1000 * mult);
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(200 * mult);
try
{
to.sendData(new byte[1000000]);
@@ -178,7 +185,7 @@ public class AllTests
test(connection == to.ice_getConnection());
try
{
- to.sleep(750 * mult);
+ to.sleep(500 * mult);
test(false);
}
catch(com.zeroc.Ice.InvocationTimeoutException ex)
@@ -203,7 +210,7 @@ public class AllTests
//
TimeoutPrx to = timeout.ice_invocationTimeout(100);
Callback cb = new Callback();
- to.sleepAsync(750 * mult).whenComplete((result, ex) ->
+ to.sleepAsync(500 * mult).whenComplete((result, ex) ->
{
test(ex != null && ex instanceof com.zeroc.Ice.TimeoutException);
cb.called();
@@ -279,7 +286,7 @@ public class AllTests
{
TimeoutPrx to = TimeoutPrx.uncheckedCast(obj.ice_timeout(250 * mult));
com.zeroc.Ice.Connection connection = connect(to);
- timeout.holdAdapter(600);
+ controller.holdAdapter(-1);
connection.close(com.zeroc.Ice.ConnectionClose.GracefullyWithWait);
try
{
@@ -289,23 +296,27 @@ public class AllTests
{
test(false);
}
- try
- {
- Thread.sleep(650 * mult);
- }
- catch(java.lang.InterruptedException ex)
+ while(true)
{
+ try
+ {
+ connection.getInfo();
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ catch(com.zeroc.Ice.ConnectionManuallyClosedException ex)
+ {
+ // Expected.
+ test(ex.graceful);
+ break;
+ }
}
- try
- {
- connection.getInfo();
- test(false);
- }
- catch(com.zeroc.Ice.ConnectionManuallyClosedException ex)
- {
- // Expected.
- test(ex.graceful);
- }
+ controller.resumeAdapter();
timeout.op(); // Ensure adapter is active.
}
out.println("ok");
@@ -324,7 +335,7 @@ public class AllTests
com.zeroc.Ice.Communicator comm = app.initialize(initData);
TimeoutPrx to = TimeoutPrx.uncheckedCast(comm.stringToProxy(sref));
connect(to);
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -334,13 +345,15 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Calling ice_timeout() should have no effect.
//
- timeout.op(); // Ensure adapter is active.
to = TimeoutPrx.uncheckedCast(to.ice_timeout(1000 * mult));
connect(to);
- timeout.holdAdapter(500 * mult);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -350,6 +363,8 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
comm.destroy();
}
{
@@ -369,7 +384,7 @@ public class AllTests
com.zeroc.Ice.Communicator comm = app.initialize(initData);
TimeoutPrx to = TimeoutPrx.uncheckedCast(comm.stringToProxy(sref));
- timeout.holdAdapter(750 * mult);
+ controller.holdAdapter(-1);
try
{
to.op();
@@ -379,11 +394,13 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Calling ice_timeout() should have no effect on the connect timeout.
//
- timeout.op(); // Ensure adapter is active.
- timeout.holdAdapter(750 * mult);
+ controller.holdAdapter(-1);
to = to.ice_timeout(1000 * mult);
try
{
@@ -394,13 +411,15 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
+
//
// Verify that timeout set via ice_timeout() is still used for requests.
//
- timeout.op(); // Ensure adapter is active.
to = to.ice_timeout(250);
connect(to);
- timeout.holdAdapter(750 * mult);
+ controller.holdAdapter(-1);
try
{
to.sendData(seq);
@@ -410,6 +429,8 @@ public class AllTests
{
// Expected.
}
+ controller.resumeAdapter();
+ timeout.op(); // Ensure adapter is active.
comm.destroy();
}
{
@@ -421,10 +442,11 @@ public class AllTests
initData.properties.setProperty("Ice.Override.CloseTimeout", "100");
com.zeroc.Ice.Communicator comm = app.initialize(initData);
comm.stringToProxy(sref).ice_getConnection();
- timeout.holdAdapter(800);
+ controller.holdAdapter(-1);
long now = System.nanoTime();
comm.destroy();
test(System.nanoTime() - now < 700 * 1000000);
+ controller.resumeAdapter();
}
out.println("ok");
@@ -506,6 +528,6 @@ public class AllTests
}
out.println("ok");
- return timeout;
+ controller.shutdown();
}
}
diff --git a/java/test/src/main/java/test/Ice/timeout/Client.java b/java/test/src/main/java/test/Ice/timeout/Client.java
index 632535964b9..7190134c4d8 100644
--- a/java/test/src/main/java/test/Ice/timeout/Client.java
+++ b/java/test/src/main/java/test/Ice/timeout/Client.java
@@ -16,8 +16,7 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- TimeoutPrx timeout = AllTests.allTests(this);
- timeout.shutdown();
+ AllTests.allTests(this);
return 0;
}
diff --git a/java/test/src/main/java/test/Ice/timeout/Server.java b/java/test/src/main/java/test/Ice/timeout/Server.java
index 71a555dbb6f..547b78f719b 100644
--- a/java/test/src/main/java/test/Ice/timeout/Server.java
+++ b/java/test/src/main/java/test/Ice/timeout/Server.java
@@ -15,9 +15,15 @@ public class Server extends test.Util.Application
public int run(String[] args)
{
com.zeroc.Ice.Communicator communicator = communicator();
+
com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new TimeoutI(), com.zeroc.Ice.Util.stringToIdentity("timeout"));
adapter.activate();
+
+ com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller"));
+ controllerAdapter.activate();
+
return WAIT;
}
@@ -27,6 +33,9 @@ public class Server extends test.Util.Application
com.zeroc.Ice.InitializationData initData = super.getInitData(args, rArgs);
initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout");
initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0));
+ initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1));
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
//
// Limit the recv buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
diff --git a/java/test/src/main/java/test/Ice/timeout/Test.ice b/java/test/src/main/java/test/Ice/timeout/Test.ice
index 93b88a53f06..773e88d88d4 100644
--- a/java/test/src/main/java/test/Ice/timeout/Test.ice
+++ b/java/test/src/main/java/test/Ice/timeout/Test.ice
@@ -20,9 +20,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/timeout/TimeoutI.java b/java/test/src/main/java/test/Ice/timeout/TimeoutI.java
index 9a99bbd57b8..ea0b3db47e1 100644
--- a/java/test/src/main/java/test/Ice/timeout/TimeoutI.java
+++ b/java/test/src/main/java/test/Ice/timeout/TimeoutI.java
@@ -13,32 +13,6 @@ import test.Ice.timeout.Test.Timeout;
class TimeoutI implements Timeout
{
- static class ActivateAdapterThread extends Thread
- {
- ActivateAdapterThread(com.zeroc.Ice.ObjectAdapter adapter, int timeout)
- {
- _adapter = adapter;
- _timeout = timeout;
- }
-
- @Override
- public void run()
- {
- _adapter.waitForHold();
- try
- {
- sleep(_timeout);
- }
- catch(InterruptedException ex)
- {
- }
- _adapter.activate();
- }
-
- com.zeroc.Ice.ObjectAdapter _adapter;
- int _timeout;
- }
-
@Override
public void op(com.zeroc.Ice.Current current)
{
@@ -61,18 +35,4 @@ class TimeoutI implements Timeout
System.err.println("sleep interrupted");
}
}
-
- @Override
- public void holdAdapter(int to, com.zeroc.Ice.Current current)
- {
- current.adapter.hold();
- Thread thread = new ActivateAdapterThread(current.adapter, to);
- thread.start();
- }
-
- @Override
- public void shutdown(com.zeroc.Ice.Current current)
- {
- current.adapter.getCommunicator().shutdown();
- }
}
diff --git a/js/test/Ice/timeout/Client.js b/js/test/Ice/timeout/Client.js
index 0cb0b006b72..80d5c2238b1 100644
--- a/js/test/Ice/timeout/Client.js
+++ b/js/test/Ice/timeout/Client.js
@@ -32,7 +32,7 @@
var allTests = function(out, communicator)
{
var failCB = function() { test(false); };
- var ref, obj, mult, timeout, to, connection, comm, now;
+ var ref, obj, mult, timeout, controller, to, connection, comm, now;
var p = new Ice.Promise();
var test = function(b, ex)
@@ -75,9 +75,13 @@
{
timeout = obj;
test(timeout !== null);
+
+ controller = Test.ControllerPrx.uncheckedCast(communicator.stringToProxy("controller:default -p 12011"));
+ test(controller !== null);
+
out.write("testing connect timeout... ");
to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(100 * mult));
- return timeout.holdAdapter(1000 * mult);
+ return controller.holdAdapter(-1);
}
).then(() => to.ice_getConnection()
).then(() => to.op() // Expect ConnectTimeoutException.
@@ -86,12 +90,12 @@
ex =>
{
test(ex instanceof Ice.ConnectTimeoutException, ex);
- return timeout.op(); // Ensure adapter is active.
+ return controller.resumeAdapter().then(() => timeout.op());
}
).then(() =>
{
to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(1000 * mult));
- return timeout.holdAdapter(500 * mult);
+ return controller.holdAdapter(200 * mult);
}
).then(() => to.ice_getConnection()
).then(() => to.op() // Expect success.
@@ -105,20 +109,20 @@
).then(() =>
{
seq = new Uint8Array(10000000);
- return timeout.holdAdapter(1500 * mult);
+ return controller.holdAdapter(-1);
}
).then(() => to.sendData(seq) // Expect TimeoutException
).then(() => test(false),
ex =>
{
test(ex instanceof Ice.TimeoutException, ex);
- return timeout.op(); // Ensure adapter is active.
+ return controller.resumeAdapter().then(() => timeout.op());
}
).then(() =>
{
// NOTE: 30s timeout is necessary for Firefox/IE on Windows
to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(30000 * mult));
- return timeout.holdAdapter(500 * mult);
+ return controller.holdAdapter(200 * mult);
}
).then(() => to.sendData(new Uint8Array(5 * 1024)) // Expect success.
).then(() =>
@@ -136,7 +140,7 @@
).then(con =>
{
test(to.ice_getCachedConnection() === obj.ice_getCachedConnection());
- return to.sleep(750);
+ return to.sleep(500);
}
).then(
failCB,
@@ -165,7 +169,7 @@
).then(con =>
{
connection = con;
- return timeout.holdAdapter(1500);
+ return controller.holdAdapter(-1);
}
).then(() => connection.close(Ice.ConnectionClose.GracefullyWithWait)
).then(() =>
@@ -179,18 +183,21 @@
test(false);
}
}
- ).delay(1000).then(() =>
+ ).then(() =>
{
- try
- {
- connection.getInfo();
- test(false);
- }
- catch(ex)
- {
- test(ex instanceof Ice.ConnectionManuallyClosedException, ex); // Expected
+ var loop = () => {
+ try
+ {
+ connection.getInfo();
+ return Ice.Promise.delay(10).then(loop);
+ }
+ catch(ex)
+ {
+ test(ex instanceof Ice.ConnectionManuallyClosedException, ex); // Expected
+ return controller.resumeAdapter().then(() => timeout.op());
+ }
}
- return timeout.op();
+ return loop();
}
).then(() =>
{
@@ -218,7 +225,7 @@
}
).then(c =>
{
- return timeout.holdAdapter(750 * 2 * mult);
+ return controller.holdAdapter(-1);
}
).then(() => to.sendData(seq) // Expect TimeoutException.
).then(
@@ -226,7 +233,7 @@
ex =>
{
test(ex instanceof Ice.TimeoutException, ex);
- return timeout.op(); // Ensure adapter is active.
+ return controller.resumeAdapter().then(() => timeout.op());
}
).then(() =>
{
@@ -235,7 +242,7 @@
}
).then(c =>
{
- return timeout.holdAdapter(750 * 2 * mult);
+ return controller.holdAdapter(-1);
}
).then(() => to.sendData(seq) // Expect TimeoutException.
).then(
@@ -243,7 +250,7 @@
ex =>
{
test(ex instanceof Ice.TimeoutException, ex);
- return comm.destroy();
+ return controller.resumeAdapter().then(() => timeout.op()).then(() => comm.destroy());
}
).then(() =>
{
@@ -262,7 +269,7 @@
}
comm = Ice.initialize(initData);
to = Test.TimeoutPrx.uncheckedCast(comm.stringToProxy(ref));
- return timeout.holdAdapter(750 * mult);
+ return controller.holdAdapter(-1);
}
).then(() => to.op()
).then(
@@ -270,9 +277,9 @@
ex =>
{
test(ex instanceof Ice.ConnectTimeoutException, ex);
- return timeout.op(); // Ensure adapter is active.
+ return controller.resumeAdapter().then(() => timeout.op());
}
- ).then(() => timeout.holdAdapter(750 * mult)
+ ).then(() => controller.holdAdapter(-1)
).then(() =>
{
//
@@ -285,21 +292,21 @@
ex =>
{
test(ex instanceof Ice.ConnectTimeoutException, ex);
- return timeout.op(); // Ensure adapter is active.
+ return controller.resumeAdapter().then(() => timeout.op());
}
).then(() =>
{
to = Test.TimeoutPrx.uncheckedCast(to.ice_timeout(100 * mult));
return connect(to); // Force connection.
}
- ).then(obj => timeout.holdAdapter(750 * mult)
+ ).then(obj => controller.holdAdapter(-1)
).then(() => to.sendData(seq)
).then(
failCB,
ex =>
{
test(ex instanceof Ice.TimeoutException, ex);
- return comm.destroy();
+ return controller.resumeAdapter().then(() => timeout.op()).then(() => comm.destroy());
}
).then(() =>
{
@@ -312,7 +319,7 @@
comm = Ice.initialize(initData);
return comm.stringToProxy(ref).ice_getConnection();
}
- ).then(() => timeout.holdAdapter(500)
+ ).then(() => controller.holdAdapter(-1)
).then(() =>
{
now = Date.now();
@@ -322,8 +329,12 @@
{
var t = Date.now();
test(t - now < 400);
+ return controller.resumeAdapter();
+ }
+ ).then(() =>
+ {
out.writeLine("ok");
- return timeout.shutdown();
+ return controller.shutdown();
}
).then(p.resolve, p.reject);
return p;
@@ -349,7 +360,7 @@
if(typeof(navigator) !== 'undefined' && isSafari() && isWorker())
{
out.writeLine("Test not supported with Safari web workers.");
- return Test.TimeoutPrx.uncheckedCast(c.stringToProxy("timeout:default -p 12010")).shutdown();
+ return Test.TimeoutPrx.uncheckedCast(c.stringToProxy("controller:default -p 12010")).shutdown();
}
else
{
diff --git a/js/test/Ice/timeout/Test.ice b/js/test/Ice/timeout/Test.ice
index aad831a9993..d611817c1ac 100644
--- a/js/test/Ice/timeout/Test.ice
+++ b/js/test/Ice/timeout/Test.ice
@@ -19,9 +19,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}
diff --git a/objective-c/test/Ice/timeout/AllTests.m b/objective-c/test/Ice/timeout/AllTests.m
index e4853252a1a..b9322d11f2c 100644
--- a/objective-c/test/Ice/timeout/AllTests.m
+++ b/objective-c/test/Ice/timeout/AllTests.m
@@ -102,7 +102,7 @@ connectPrx(id<TestTimeoutTimeoutPrx> prx)
return [prx ice_getConnection];
}
-id<TestTimeoutTimeoutPrx>
+void
timeoutAllTests(id<ICECommunicator> communicator)
{
NSString* sref = @"timeout:default -p 12010";
@@ -112,14 +112,17 @@ timeoutAllTests(id<ICECommunicator> communicator)
id<TestTimeoutTimeoutPrx> timeout = [TestTimeoutTimeoutPrx checkedCast:obj];
test(timeout);
+ id<TestTimeoutControllerPrx> controller =
+ [TestTimeoutControllerPrx checkedCast:[communicator stringToProxy:@"controller:default -p 12011"]];
+ test(controller);
+
tprintf("testing connect timeout... ");
{
//
// Expect ConnectTimeoutException.
//
id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[obj ice_timeout:500]];
- [to holdAdapter:1000];
- [[to ice_getConnection] close:ICEConnectionCloseForcefully]; // Force a reconnect.
+ [controller holdAdapter:-1];
@try
{
[to op];
@@ -129,14 +132,15 @@ timeoutAllTests(id<ICECommunicator> communicator)
{
// Expected.
}
+ [controller resumeAdapter];
+ [timeout op]; // Ensure adapter is active.
}
{
//
// Expect success.
//
- [timeout op]; // Ensure adapter is active.
id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[obj ice_timeout:2000]];
- [to holdAdapter:500];
+ [controller holdAdapter:200];
[[to ice_getConnection] close:ICEConnectionCloseForcefully]; // Force a reconnect.
@try
{
@@ -159,7 +163,7 @@ timeoutAllTests(id<ICECommunicator> communicator)
//
id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[obj ice_timeout:250]];
connectPrx(to);
- [to holdAdapter:750];
+ [controller holdAdapter:-1];
@try
{
[to sendData:seq];
@@ -169,14 +173,15 @@ timeoutAllTests(id<ICECommunicator> communicator)
{
// Expected.
}
+ [controller resumeAdapter];
+ [timeout op]; // Ensure adapter is active.
}
{
//
// Expect success.
//
- [timeout op]; // Ensure adapter is active.
id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[obj ice_timeout:2000]];
- [to holdAdapter:500];
+ [controller holdAdapter:200];
@try
{
TestTimeoutByteSeq* seq = [TestTimeoutMutableByteSeq dataWithLength:1000000];
@@ -196,7 +201,7 @@ timeoutAllTests(id<ICECommunicator> communicator)
test(connection == [to ice_getConnection]);
@try
{
- [to sleep:750];
+ [to sleep:500];
test(NO);
}
@catch(ICEInvocationTimeoutException*)
@@ -221,7 +226,7 @@ timeoutAllTests(id<ICECommunicator> communicator)
//
id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[obj ice_invocationTimeout:100]];
TestTimeoutCallback* cb = [TestTimeoutCallback create];
- [to begin_sleep:750 response:^ { [cb responseEx]; } exception:^(ICEException* ex) { [cb exceptionEx:ex]; }];
+ [to begin_sleep:500 response:^ { [cb responseEx]; } exception:^(ICEException* ex) { [cb exceptionEx:ex]; }];
[cb check];
[obj ice_ping];
}
@@ -295,7 +300,7 @@ timeoutAllTests(id<ICECommunicator> communicator)
id<ICECommunicator> comm = [ICEUtil createCommunicator:initData];
id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[comm stringToProxy:sref]];
connectPrx(to);
- [timeout holdAdapter:500];
+ [controller holdAdapter:-1];
@try
{
[to sendData:seq];
@@ -305,13 +310,14 @@ timeoutAllTests(id<ICECommunicator> communicator)
{
// Expected.
}
+ [controller resumeAdapter];
+ [timeout op]; // Ensure adapter is active.
//
// Calling ice_timeout() should have no effect.
//
- [timeout op]; // Ensure adapter is active.
to = [TestTimeoutTimeoutPrx uncheckedCast:[to ice_timeout:1000]];
connectPrx(to);
- [timeout holdAdapter:500];
+ [controller holdAdapter:-1];
@try
{
[to sendData:seq];
@@ -321,6 +327,8 @@ timeoutAllTests(id<ICECommunicator> communicator)
{
// Expected.
}
+ [controller resumeAdapter];
+ [timeout op]; // Ensure adapter is active.
[comm destroy];
}
{
@@ -331,7 +339,7 @@ timeoutAllTests(id<ICECommunicator> communicator)
[initData setProperties:[[communicator getProperties] clone]];
[[initData properties] setProperty:@"Ice.Override.ConnectTimeout" value:@"250"];
id<ICECommunicator> comm = [ICEUtil createCommunicator:initData];
- [timeout holdAdapter:750];
+ [controller holdAdapter:-1];
id<TestTimeoutTimeoutPrx> to = [TestTimeoutTimeoutPrx uncheckedCast:[comm stringToProxy:sref]];
@try
{
@@ -342,11 +350,12 @@ timeoutAllTests(id<ICECommunicator> communicator)
{
// Expected.
}
+ [controller resumeAdapter];
+ [timeout op]; // Ensure adapter is active.
//
// Calling ice_timeout() should have no effect on the connect timeout.
//
- [timeout op]; // Ensure adapter is active.
- [timeout holdAdapter:750];
+ [controller holdAdapter:-1];
to = [TestTimeoutTimeoutPrx uncheckedCast:[to ice_timeout:1000]];
@try
{
@@ -357,14 +366,15 @@ timeoutAllTests(id<ICECommunicator> communicator)
{
// Expected.
}
+ [controller resumeAdapter];
+ [timeout op]; // Ensure adapter is active.
//
// Verify that timeout set via ice_timeout() is still used for requests.
//
- [timeout op]; // Ensure adapter is active.
to = [TestTimeoutTimeoutPrx uncheckedCast:[to ice_timeout:100]];
connectPrx(to);
[to ice_getConnection]; // Establish connection
- [timeout holdAdapter:500];
+ [controller holdAdapter:-1];
@try
{
[to sendData:seq];
@@ -374,9 +384,11 @@ timeoutAllTests(id<ICECommunicator> communicator)
{
// Expected.
}
+ [controller resumeAdapter];
+ [timeout op]; // Ensure adapter is active.
[comm destroy];
}
tprintf("ok\n");
- return timeout;
+ [controller shutdown];
}
diff --git a/objective-c/test/Ice/timeout/Client.m b/objective-c/test/Ice/timeout/Client.m
index 6acae94b5bc..29271e90038 100644
--- a/objective-c/test/Ice/timeout/Client.m
+++ b/objective-c/test/Ice/timeout/Client.m
@@ -14,9 +14,8 @@
static int
run(id<ICECommunicator> communicator)
{
- id<TestTimeoutTimeoutPrx> timeoutAllTests(id<ICECommunicator>);
- id<TestTimeoutTimeoutPrx> timeout = timeoutAllTests(communicator);
- [timeout shutdown];
+ void timeoutAllTests(id<ICECommunicator>);
+ timeoutAllTests(communicator);
return EXIT_SUCCESS;
}
diff --git a/objective-c/test/Ice/timeout/Server.m b/objective-c/test/Ice/timeout/Server.m
index a2e002db7dd..5e87f12f546 100644
--- a/objective-c/test/Ice/timeout/Server.m
+++ b/objective-c/test/Ice/timeout/Server.m
@@ -14,12 +14,18 @@
static int
run(id<ICECommunicator> communicator)
{
- [[communicator getProperties] setProperty:@"TestAdapter.Endpoints" value:@"default -p 12010:udp"];
+ [[communicator getProperties] setProperty:@"TestAdapter.Endpoints" value:@"default -p 12010"];
+ [[communicator getProperties] setProperty:@"ControllerAdapter.Endpoints" value:@"default -p 12011"];
+ [[communicator getProperties] setProperty:@"ControllerAdapter.ThreadPool.Size" value:@"1"];
+
id<ICEObjectAdapter> adapter = [communicator createObjectAdapter:@"TestAdapter"];
- ICEObject* object = [TimeoutI timeout];
- [adapter add:object identity:[ICEUtil stringToIdentity:@"timeout"]];
+ [adapter add:[TimeoutI timeout] identity:[ICEUtil stringToIdentity:@"timeout"]];
[adapter activate];
+ id<ICEObjectAdapter> controllerAdapter = [communicator createObjectAdapter:@"ControllerAdapter"];
+ [controllerAdapter add:[ControllerI controller:adapter] identity:[ICEUtil stringToIdentity:@"controller"]];
+ [controllerAdapter activate];
+
serverReady(communicator);
[communicator waitForShutdown];
diff --git a/objective-c/test/Ice/timeout/TestI.h b/objective-c/test/Ice/timeout/TestI.h
index c35bb20024f..d330bb0f858 100644
--- a/objective-c/test/Ice/timeout/TestI.h
+++ b/objective-c/test/Ice/timeout/TestI.h
@@ -13,6 +13,14 @@
-(void) op:(ICECurrent *)current;
-(void) sendData:(TestTimeoutMutableByteSeq *)seq current:(ICECurrent *)current;
-(void) sleep:(ICEInt)to current:(ICECurrent *)current;
+@end
+
+@interface ControllerI : TestTimeoutController<TestTimeoutController>
+{
+ id<ICEObjectAdapter> adapter_;
+}
++(id) controller:(id<ICEObjectAdapter>)adapter;
-(void) holdAdapter:(ICEInt)to current:(ICECurrent *)current;
+-(void) resumeAdapter:(ICECurrent *)current;
-(void) shutdown:(ICECurrent *)current;
@end
diff --git a/objective-c/test/Ice/timeout/TestI.m b/objective-c/test/Ice/timeout/TestI.m
index c3511609b07..843bed6d3de 100644
--- a/objective-c/test/Ice/timeout/TestI.m
+++ b/objective-c/test/Ice/timeout/TestI.m
@@ -84,3 +84,48 @@
[[current.adapter getCommunicator] shutdown];
}
@end
+
+@implementation ControllerI
+-(id) init:(id<ICEObjectAdapter>)adapter
+{
+ self = [super init];
+ if(!self)
+ {
+ return nil;
+ }
+ adapter_ = ICE_RETAIN(adapter);
+ return self;
+}
++(id) controller:(id<ICEObjectAdapter>)adapter
+{
+ return ICE_AUTORELEASE([[self alloc] init:adapter]);
+}
+
+#if defined(__clang__) && !__has_feature(objc_arc)
+-(void) dealloc
+{
+ [adapter_ release];
+ [super dealloc];
+}
+#endif
+
+-(void) holdAdapter:(ICEInt)to current:(ICECurrent*)current
+{
+ [adapter_ hold];
+ if(to >= 0)
+ {
+ ActivateAdapterThread* thread = [ActivateAdapterThread activateAdapterThread:adapter_ timeout:to];
+ [thread start];
+ }
+}
+
+-(void) resumeAdapter:(ICECurrent*)current
+{
+ [adapter_ activate];
+}
+
+-(void) shutdown:(ICECurrent*)current
+{
+ [[current.adapter getCommunicator] shutdown];
+}
+@end
diff --git a/objective-c/test/Ice/timeout/TimeoutTest.ice b/objective-c/test/Ice/timeout/TimeoutTest.ice
index 93beab7d52d..ce87442d6d2 100644
--- a/objective-c/test/Ice/timeout/TimeoutTest.ice
+++ b/objective-c/test/Ice/timeout/TimeoutTest.ice
@@ -20,9 +20,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}
diff --git a/php/test/Ice/timeout/Client.php b/php/test/Ice/timeout/Client.php
index 93a136ebb47..ac51c5795d3 100644
--- a/php/test/Ice/timeout/Client.php
+++ b/php/test/Ice/timeout/Client.php
@@ -75,6 +75,9 @@ function allTests($communicator)
$timeout = $timeout->ice_checkedCast("::Test::Timeout");
test($timeout);
+ $controller = $communicator->stringToProxy("controller:default -p 12011")->ice_checkedCast("::Test::Controller");
+ test($controller);
+
echo("testing connect timeout... ");
flush();
@@ -83,7 +86,7 @@ function allTests($communicator)
// Expect ConnectTimeoutException.
//
$to = $timeout->ice_timeout(100);
- $timeout->holdAdapter(500);
+ $controller->holdAdapter(-1);
try
{
$to->op();
@@ -97,14 +100,15 @@ function allTests($communicator)
test(false);
}
}
+ $controller->resumeAdapter();
+ $timeout->op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- $timeout->op(); // Ensure adapter is active.
$to =$timeout->ice_timeout(1000);
- $timeout->holdAdapter(500);
+ $controller->holdAdapter(200);
try
{
$to->op();
@@ -126,7 +130,7 @@ function allTests($communicator)
//
$to = $timeout->ice_timeout(250)->ice_uncheckedCast("::Test::Timeout");
connect($to);
- $timeout->holdAdapter(1000); // Use larger value, marshalling of byte arrays is much slower in PHP
+ $controller->holdAdapter(-1);
try
{
$to->sendData($seq);
@@ -141,14 +145,15 @@ function allTests($communicator)
test(false);
}
}
+ $controller->resumeAdapter();
+ $timeout->op(); // Ensure adapter is active.
}
{
//
// Expect success.
//
- $timeout->op(); // Ensure adapter is active.
$to = $timeout->ice_timeout(1000)->ice_uncheckedCast("::Test::Timeout");
- $timeout->holdAdapter(500);
+ $controller->holdAdapter(200);
try
{
$data = array_fill(0, 1000000, 0x01);
@@ -169,7 +174,7 @@ function allTests($communicator)
test($connection == $to->ice_getConnection());
try
{
- $to->sleep(750);
+ $to->sleep(500);
test(false);
}
catch(Exception $ex)
@@ -203,7 +208,7 @@ function allTests($communicator)
$con = connect($to);
try
{
- $to->sleep(750);
+ $to->sleep(500);
test(false);
}
catch(Exception $ex)
@@ -232,7 +237,7 @@ function allTests($communicator)
{
$to = $timeout->ice_timeout(250)->ice_uncheckedCast("::Test::Timeout");
$connection = connect($to);
- $timeout->holdAdapter(600);
+ $controller->holdAdapter(-1);
$connection->close($CloseGracefullyAndWait);
try
{
@@ -242,17 +247,21 @@ function allTests($communicator)
{
test(false);
}
- usleep(650 * 1000);
- try
- {
- $connection->getInfo();
- test(false);
- }
- catch(Exception $ex)
+ while(true)
{
- // Expected.
- test($ex->graceful);
+ try
+ {
+ $connection->getInfo();
+ usleep(10);
+ }
+ catch(Exception $ex)
+ {
+ // Expected.
+ test($ex->graceful);
+ break;
+ }
}
+ $controller->resumeAdapter();
$timeout->op(); // Ensure adapter is active.
}
echo("ok\n");
@@ -271,7 +280,7 @@ function allTests($communicator)
$comm = eval($NS ? "return Ice\\initialize(\$initData);" : "return Ice_initialize(\$initData);");
$to = $comm->stringToProxy($sref)->ice_uncheckedCast("::Test::Timeout");
connect($to);
- $timeout->holdAdapter(1000); // Use larger value, marshalling of byte arrays is much slower in PHP
+ $controller->holdAdapter(-1); // Use larger value, marshalling of byte arrays is much slower in PHP
try
{
$to->sendData($seq);
@@ -286,13 +295,14 @@ function allTests($communicator)
test(false);
}
}
+ $controller->resumeAdapter();
+ $timeout->op(); // Ensure adapter is active.
//
// Calling ice_timeout() should have no effect.
//
- $timeout->op(); // Ensure adapter is active.
$to = $to->ice_timeout(1000)->ice_uncheckedCast("::Test::Timeout");
connect($to);
- $timeout->holdAdapter(1000);
+ $controller->holdAdapter(-1);
try
{
$to->sendData($seq);
@@ -307,6 +317,8 @@ function allTests($communicator)
test(false);
}
}
+ $controller->resumeAdapter();
+ $timeout->op(); // Ensure adapter is active.
$comm->destroy();
}
{
@@ -318,7 +330,7 @@ function allTests($communicator)
$initData->properties->setProperty("Ice.Override.ConnectTimeout", "250");
$comm = eval($NS ? "return Ice\\initialize(\$initData);" : "return Ice_initialize(\$initData);");
$to = $comm->stringToProxy($sref)->ice_uncheckedCast("::Test::Timeout");
- $timeout->holdAdapter(750);
+ $controller->holdAdapter(-1);
try
{
$to->op();
@@ -333,11 +345,12 @@ function allTests($communicator)
test(false);
}
}
+ $controller->resumeAdapter();
+ $timeout->op(); // Ensure adapter is active.
//
// Calling ice_timeout() should have no effect on the connect timeout.
//
- $timeout->op(); // Ensure adapter is active.
- $timeout->holdAdapter(750);
+ $controller->holdAdapter(-1);
$to = $to->ice_timeout(1000)->ice_uncheckedCast("::Test::Timeout");
try
{
@@ -352,8 +365,9 @@ function allTests($communicator)
echo($ex);
test(false);
}
-
}
+ $controller->resumeAdapter();
+ $timeout->op(); // Ensure adapter is active.
//
// Verify that timeout set via ice_timeout() is still used for requests.
//
@@ -362,7 +376,7 @@ function allTests($communicator)
// $timeout->op(); // Ensure adapter is active.
// $to = $to->ice_timeout(250)->ice_uncheckedCast("::Test::Timeout");
// connect($to);
- // $timeout->holdAdapter(1000); // Use larger value, marshalling of byte arrays is much slower in PHP
+ // $controller->holdAdapter(1000); // Use larger value, marshalling of byte arrays is much slower in PHP
// try
// {
// $to->sendData($seq);
@@ -388,15 +402,16 @@ function allTests($communicator)
$initData->properties->setProperty("Ice.Override.CloseTimeout", "100");
$comm = eval($NS ? "return Ice\\initialize(\$initData);" : "return Ice_initialize(\$initData);");
$to = $comm->stringToProxy($sref)->ice_uncheckedCast("::Test::Timeout");
- $timeout->holdAdapter(800);
+ $controller->holdAdapter(-1);
$begin = microtime(true);
$comm->destroy();
test(microtime(true) - $begin < 0.7);
+ $controller->resumeAdapter();
}
echo("ok\n");
- $timeout->shutdown();
+ $controller->shutdown();
$communicator->destroy();
}
@@ -420,8 +435,7 @@ $initData->properties->setProperty("Ice.Warn.Connections", "0");
//
$initData->properties->setProperty("Ice.TCP.SndSize", "50000");
-$communicator = eval($NS ? "return Ice\\initialize(\$initData);" :
- "return Ice_initialize(\$initData);");
+$communicator = eval($NS ? "return Ice\\initialize(\$initData);" : "return Ice_initialize(\$initData);");
allTests($communicator);
diff --git a/php/test/Ice/timeout/Test.ice b/php/test/Ice/timeout/Test.ice
index aad831a9993..d611817c1ac 100644
--- a/php/test/Ice/timeout/Test.ice
+++ b/php/test/Ice/timeout/Test.ice
@@ -19,9 +19,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}
diff --git a/python/test/Ice/timeout/AllTests.py b/python/test/Ice/timeout/AllTests.py
index d65742cb335..3023398b75a 100644
--- a/python/test/Ice/timeout/AllTests.py
+++ b/python/test/Ice/timeout/AllTests.py
@@ -68,24 +68,29 @@ def allTests(communicator):
timeout = Test.TimeoutPrx.checkedCast(obj)
test(timeout != None)
+ controller = Test.ControllerPrx.checkedCast(communicator.stringToProxy("controller:default -p 12011"))
+ test(controller != None)
+
sys.stdout.write("testing connect timeout... ")
sys.stdout.flush()
#
# Expect ConnectTimeoutException.
#
to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(100))
- timeout.holdAdapter(500)
+ controller.holdAdapter(-1)
try:
to.op()
test(False)
except Ice.ConnectTimeoutException:
pass # Expected.
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
+
#
# Expect success.
#
- timeout.op() # Ensure adapter is active.
to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(1000))
- timeout.holdAdapter(500)
+ controller.holdAdapter(200)
try:
to.op()
except Ice.ConnectTimeoutException:
@@ -106,18 +111,19 @@ def allTests(communicator):
seq = bytes([0 for x in range(0, 10000000)])
to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(250))
connect(to)
- timeout.holdAdapter(750)
+ controller.holdAdapter(-1)
try:
to.sendData(seq)
test(False)
except Ice.TimeoutException:
pass # Expected.
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
#
# Expect success.
#
- timeout.op() # Ensure adapter is active.
to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(1000))
- timeout.holdAdapter(500)
+ controller.holdAdapter(200)
try:
if sys.version_info[0] == 2:
seq2 = []
@@ -137,7 +143,7 @@ def allTests(communicator):
to = Test.TimeoutPrx.uncheckedCast(obj.ice_invocationTimeout(100))
test(connection == to.ice_getConnection())
try:
- to.sleep(750)
+ to.sleep(500)
test(False)
except Ice.InvocationTimeoutException:
pass
@@ -155,7 +161,7 @@ def allTests(communicator):
# #
# to = Test.TimeoutPrx.uncheckedCast(obj.ice_invocationTimeout(250))
# cb = new Callback()
- # to.begin_sleep(750, newCallback_Timeout_sleep(cb, &Callback.responseEx, &Callback.exceptionEx))
+ # to.begin_sleep(500, newCallback_Timeout_sleep(cb, &Callback.responseEx, &Callback.exceptionEx))
# cb.check()
# #
@@ -171,19 +177,21 @@ def allTests(communicator):
sys.stdout.flush()
to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(250))
connection = connect(to)
- timeout.holdAdapter(600)
+ controller.holdAdapter(-1)
connection.close(Ice.ConnectionClose.GracefullyWithWait)
try:
connection.getInfo(); # getInfo() doesn't throw in the closing state.
except Ice.LocalException:
test(False)
- time.sleep(0.65)
- try:
- connection.getInfo()
- test(False)
- except Ice.ConnectionManuallyClosedException as ex:
- # Expected.
- test(ex.graceful)
+ while True:
+ try:
+ connection.getInfo()
+ time.sleep(0.001)
+ except Ice.ConnectionManuallyClosedException as ex:
+ # Expected.
+ test(ex.graceful)
+ break
+ controller.resumeAdapter()
timeout.op() # Ensure adapter is active.
print("ok")
@@ -201,24 +209,28 @@ def allTests(communicator):
comm = Ice.initialize(initData)
to = Test.TimeoutPrx.uncheckedCast(comm.stringToProxy(sref))
connect(to)
- timeout.holdAdapter(500)
+ controller.holdAdapter(-1)
try:
to.sendData(seq)
test(False)
except Ice.TimeoutException:
pass # Expected.
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
+
#
# Calling ice_timeout() should have no effect.
#
- timeout.op() # Ensure adapter is active.
to = Test.TimeoutPrx.uncheckedCast(to.ice_timeout(1000))
connect(to)
- timeout.holdAdapter(500)
+ controller.holdAdapter(-1)
try:
to.sendData(seq)
test(False)
except Ice.TimeoutException:
pass # Expected.
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
comm.destroy()
#
# Test Ice.Override.ConnectTimeout.
@@ -227,36 +239,40 @@ def allTests(communicator):
initData.properties = communicator.getProperties().clone()
initData.properties.setProperty("Ice.Override.ConnectTimeout", "250")
comm = Ice.initialize(initData)
- timeout.holdAdapter(750)
+ controller.holdAdapter(-1)
to = Test.TimeoutPrx.uncheckedCast(comm.stringToProxy(sref))
try:
to.op()
test(False)
except Ice.ConnectTimeoutException:
pass # Expected.
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
#
# Calling ice_timeout() should have no effect on the connect timeout.
#
- timeout.op() # Ensure adapter is active.
- timeout.holdAdapter(750)
+ controller.holdAdapter(-1)
to = Test.TimeoutPrx.uncheckedCast(to.ice_timeout(1000))
try:
to.op()
test(False)
except Ice.ConnectTimeoutException:
pass # Expected.
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
#
# Verify that timeout set via ice_timeout() is still used for requests.
#
- timeout.op() # Ensure adapter is active.
to = Test.TimeoutPrx.uncheckedCast(to.ice_timeout(250))
connect(to)
- timeout.holdAdapter(750)
+ controller.holdAdapter(-1)
try:
to.sendData(seq)
test(False)
except Ice.TimeoutException:
pass # Expected.
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
comm.destroy()
#
@@ -267,11 +283,12 @@ def allTests(communicator):
initData.properties.setProperty("Ice.Override.CloseTimeout", "100")
comm = Ice.initialize(initData)
connection = comm.stringToProxy(sref).ice_getConnection()
- timeout.holdAdapter(800)
+ controller.holdAdapter(-1)
now = time.clock()
comm.destroy()
test((time.clock() - now) < 0.7)
+ controller.resumeAdapter()
print("ok")
- return timeout
+ controller.shutdown()
diff --git a/python/test/Ice/timeout/Client.py b/python/test/Ice/timeout/Client.py
index 9d6bd83e625..31ecdc34d09 100755
--- a/python/test/Ice/timeout/Client.py
+++ b/python/test/Ice/timeout/Client.py
@@ -23,9 +23,7 @@ def test(b):
raise RuntimeError('test assertion failed')
def run(args, communicator):
- timeout = AllTests.allTests(communicator)
- timeout.shutdown()
-
+ AllTests.allTests(communicator)
return True
try:
diff --git a/python/test/Ice/timeout/Server.py b/python/test/Ice/timeout/Server.py
index 917f8e90017..33bc4e780ac 100755
--- a/python/test/Ice/timeout/Server.py
+++ b/python/test/Ice/timeout/Server.py
@@ -40,19 +40,36 @@ class TimeoutI(Test.Timeout):
if timeout != 0:
time.sleep(timeout / 1000.0)
+class ControllerI(Test.Controller):
+
+ def __init__(self, adapter):
+ self.adapter = adapter
+
def holdAdapter(self, to, current=None):
- current.adapter.hold()
- t = ActivateAdapterThread(current.adapter, to)
- t.start()
+ self.adapter.hold()
+ if to >= 0:
+ t = ActivateAdapterThread(self.adapter, to)
+ t.start()
+
+ def resumeAdapter(self, current=None):
+ self.adapter.activate()
def shutdown(self, current=None):
current.adapter.getCommunicator().shutdown()
def run(args, communicator):
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010")
+ communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
adapter = communicator.createObjectAdapter("TestAdapter")
adapter.add(TimeoutI(), Ice.stringToIdentity("timeout"))
adapter.activate()
+
+ controllerAdapter = communicator.createObjectAdapter("ControllerAdapter")
+ controllerAdapter.add(ControllerI(adapter), Ice.stringToIdentity("controller"))
+ controllerAdapter.activate()
+
communicator.waitForShutdown()
return True
diff --git a/python/test/Ice/timeout/Test.ice b/python/test/Ice/timeout/Test.ice
index aad831a9993..d611817c1ac 100644
--- a/python/test/Ice/timeout/Test.ice
+++ b/python/test/Ice/timeout/Test.ice
@@ -19,9 +19,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}
diff --git a/ruby/test/Ice/timeout/AllTests.rb b/ruby/test/Ice/timeout/AllTests.rb
index 5aa15bdc739..06625c13b85 100644
--- a/ruby/test/Ice/timeout/AllTests.rb
+++ b/ruby/test/Ice/timeout/AllTests.rb
@@ -29,26 +29,30 @@ def allTests(communicator)
timeout = Test::TimeoutPrx::checkedCast(obj)
test(timeout)
+ controller = Test::ControllerPrx::checkedCast(communicator.stringToProxy("controller:default -p 12011"))
+ test(controller)
+
print "testing connect timeout... "
STDOUT.flush
#
# Expect ConnectTimeoutException.
#
to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(100))
- timeout.holdAdapter(500)
+ controller.holdAdapter(-1)
begin
to.op()
test(false)
rescue Ice::ConnectTimeoutException
# Expected.
end
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
#
# Expect success.
#
- timeout.op() # Ensure adapter is active.
to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(1000))
- timeout.holdAdapter(500)
+ controller.holdAdapter(200)
begin
to.op()
rescue Ice::ConnectTimeoutException
@@ -64,19 +68,20 @@ def allTests(communicator)
seq = "\0" * 10000000 # 10,000,000 entries
to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(250))
connect(to)
- timeout.holdAdapter(750)
+ controller.holdAdapter(-1)
begin
to.sendData(seq)
test(false)
rescue Ice::TimeoutException
# Expected.
end
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
#
# Expect success.
#
- timeout.op() # Ensure adapter is active.
to = Test::TimeoutPrx::uncheckedCast(obj.ice_timeout(1000))
- timeout.holdAdapter(500)
+ controller.holdAdapter(200)
begin
seq2 = "\0" * 1000000 # 1,000,000 entries
to.sendData(seq2)
@@ -91,7 +96,7 @@ def allTests(communicator)
to = Test::TimeoutPrx.uncheckedCast(obj.ice_invocationTimeout(100))
test(connection == to.ice_getConnection())
begin
- to.sleep(750)
+ to.sleep(500)
test(false)
rescue Ice::InvocationTimeoutException
# Expected
@@ -112,21 +117,24 @@ def allTests(communicator)
STDOUT.flush
to = Test::TimeoutPrx.uncheckedCast(obj.ice_timeout(250))
connection = connect(to);
- timeout.holdAdapter(600)
+ controller.holdAdapter(-1)
connection.close(Ice::ConnectionClose::GracefullyWithWait)
begin
connection.getInfo() # getInfo() doesn't throw in the closing state.
rescue Ice::LocalException
test(false)
end
- sleep(0.65)
- begin
- connection.getInfo()
- test(false)
- rescue Ice::ConnectionManuallyClosedException => ex
- # Expected.
- test(ex.graceful)
+ while(true)
+ begin
+ connection.getInfo()
+ sleep(0.01)
+ rescue Ice::ConnectionManuallyClosedException => ex
+ # Expected.
+ test(ex.graceful)
+ break
+ end
end
+ controller.resumeAdapter()
timeout.op() # Ensure adapter is active.
puts "ok"
@@ -143,26 +151,29 @@ def allTests(communicator)
comm = Ice.initialize(initData)
to = Test::TimeoutPrx::uncheckedCast(comm.stringToProxy(sref))
connect(to)
- timeout.holdAdapter(700)
+ controller.holdAdapter(-1)
begin
to.sendData(seq)
test(false)
rescue Ice::TimeoutException
# expected
end
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
#
# Calling ice_timeout() should have no effect.
#
- timeout.op() # Ensure adapter is active.
to = Test::TimeoutPrx::uncheckedCast(to.ice_timeout(1000))
connect(to)
- timeout.holdAdapter(500)
+ controller.holdAdapter(-1)
begin
to.sendData(seq)
test(false)
rescue Ice::TimeoutException
# Expected.
end
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
comm.destroy()
#
@@ -172,7 +183,7 @@ def allTests(communicator)
initData.properties = communicator.getProperties().clone()
initData.properties.setProperty("Ice.Override.ConnectTimeout", "250")
comm = Ice.initialize(initData)
- timeout.holdAdapter(750)
+ controller.holdAdapter(-1)
to = Test::TimeoutPrx::uncheckedCast(comm.stringToProxy(sref))
begin
to.op()
@@ -180,12 +191,13 @@ def allTests(communicator)
rescue Ice::ConnectTimeoutException
# expected
end
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
#
# Calling ice_timeout() should have no effect on the connect timeout.
#
- timeout.op() # Ensure adapter is active.
- timeout.holdAdapter(750)
+ controller.holdAdapter(-1)
to = Test::TimeoutPrx::uncheckedCast(to.ice_timeout(1000))
begin
to.op()
@@ -193,20 +205,23 @@ def allTests(communicator)
rescue Ice::ConnectTimeoutException
# expected
end
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
#
# Verify that timeout set via ice_timeout() is still used for requests.
#
- timeout.op() # Ensure adapter is active.
to = Test::TimeoutPrx::uncheckedCast(to.ice_timeout(250))
connect(to)
- timeout.holdAdapter(750)
+ controller.holdAdapter(-1)
begin
to.sendData(seq)
test(false)
rescue Ice::TimeoutException
# Expected.
end
+ controller.resumeAdapter()
+ timeout.op() # Ensure adapter is active.
comm.destroy()
#
@@ -217,12 +232,13 @@ def allTests(communicator)
initData.properties.setProperty("Ice.Override.CloseTimeout", "100")
comm = Ice.initialize(initData)
connection = comm.stringToProxy(sref).ice_getConnection();
- timeout.holdAdapter(800);
+ controller.holdAdapter(-1);
now = Time.now
comm.destroy();
test((Time.now - now) < 0.7);
+ controller.resumeAdapter()
puts "ok"
- return timeout
+ controller.shutdown()
end
diff --git a/ruby/test/Ice/timeout/Client.rb b/ruby/test/Ice/timeout/Client.rb
index 452ae4f47e5..7b9faf1f960 100755
--- a/ruby/test/Ice/timeout/Client.rb
+++ b/ruby/test/Ice/timeout/Client.rb
@@ -25,9 +25,7 @@ def test(b)
end
def run(args, communicator)
- myClass = allTests(communicator)
-
- myClass.shutdown()
+ allTests(communicator)
return true
end
diff --git a/ruby/test/Ice/timeout/Test.ice b/ruby/test/Ice/timeout/Test.ice
index aad831a9993..d611817c1ac 100644
--- a/ruby/test/Ice/timeout/Test.ice
+++ b/ruby/test/Ice/timeout/Test.ice
@@ -19,9 +19,12 @@ interface Timeout
void op();
void sendData(ByteSeq seq);
void sleep(int to);
+}
+interface Controller
+{
void holdAdapter(int to);
-
+ void resumeAdapter();
void shutdown();
}