diff options
Diffstat (limited to 'csharp/test/Ice/acm/TestI.cs')
-rw-r--r-- | csharp/test/Ice/acm/TestI.cs | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/csharp/test/Ice/acm/TestI.cs b/csharp/test/Ice/acm/TestI.cs index e370d710f2e..a70cb2f1621 100644 --- a/csharp/test/Ice/acm/TestI.cs +++ b/csharp/test/Ice/acm/TestI.cs @@ -34,7 +34,8 @@ public class RemoteCommunicatorI : RemoteCommunicatorDisp_ } properties.setProperty(name + ".ThreadPool.Size", "2"); Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, protocol + " -h \"" + host + "\""); - return RemoteObjectAdapterPrxHelper.uncheckedCast(current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))); + return RemoteObjectAdapterPrxHelper.uncheckedCast( + current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))); } public override void @@ -42,7 +43,7 @@ public class RemoteCommunicatorI : RemoteCommunicatorDisp_ { current.adapter.getCommunicator().shutdown(); } -}; +} public class RemoteObjectAdapterI : RemoteObjectAdapterDisp_ { @@ -50,7 +51,7 @@ public class RemoteObjectAdapterI : RemoteObjectAdapterDisp_ { _adapter = adapter; _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), - _adapter.getCommunicator().stringToIdentity("test"))); + Ice.Util.stringToIdentity("test"))); _adapter.activate(); } @@ -82,7 +83,7 @@ public class RemoteObjectAdapterI : RemoteObjectAdapterDisp_ private Ice.ObjectAdapter _adapter; private TestIntfPrx _testIntf; -}; +} public class TestI : TestIntfDisp_ { @@ -111,27 +112,22 @@ public class TestI : TestIntfDisp_ } } - class ConnectionCallbackI : Ice.ConnectionCallback + class HeartbeatCallbackI { public void heartbeat(Ice.Connection c) { lock(this) { - --_count; + ++_count; System.Threading.Monitor.PulseAll(this); } } - public void closed(Ice.Connection c) - { - } - public void waitForCount(int count) { lock(this) { - _count = count; - while(_count > 0) + while(_count < count) { System.Threading.Monitor.Wait(this); } @@ -139,14 +135,19 @@ public class TestI : TestIntfDisp_ } private int _count = 0; - }; + } - public override void waitForHeartbeat(int count, Ice.Current current) + public override void startHeartbeatCount(Ice.Current current) { + _callback = new HeartbeatCallbackI(); + current.con.setHeartbeatCallback(_callback.heartbeat); + } - - ConnectionCallbackI callback = new ConnectionCallbackI(); - current.con.setCallback(callback); - callback.waitForCount(count); + public override void waitForHeartbeatCount(int count, Ice.Current current) + { + System.Diagnostics.Debug.Assert(_callback != null); + _callback.waitForCount(count); } -}; + + private HeartbeatCallbackI _callback; +} |