diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-12-17 13:16:16 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-12-17 13:16:16 +0100 |
commit | a20ecaa35531284560def2aefce922eb994faa33 (patch) | |
tree | 114f47f62b95babb42df080ee374a77dbad5aa20 /java/test/Ice/ami/AllTests.java | |
parent | Fixed bug where AsyncWaitHandle wait would hang indefinitely if AsyncResult w... (diff) | |
download | ice-a20ecaa35531284560def2aefce922eb994faa33.tar.bz2 ice-a20ecaa35531284560def2aefce922eb994faa33.tar.xz ice-a20ecaa35531284560def2aefce922eb994faa33.zip |
Fixed bug 4486 - fixes to avoid hang in case of failure
Diffstat (limited to 'java/test/Ice/ami/AllTests.java')
-rw-r--r-- | java/test/Ice/ami/AllTests.java | 77 |
1 files changed, 44 insertions, 33 deletions
diff --git a/java/test/Ice/ami/AllTests.java b/java/test/Ice/ami/AllTests.java index 961a4f4330d..549bb9e41b3 100644 --- a/java/test/Ice/ami/AllTests.java +++ b/java/test/Ice/ami/AllTests.java @@ -1331,32 +1331,38 @@ public class AllTests new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. Ice.AsyncResult r; testController.holdAdapter(); - do + try { - final SentCallback cb2 = new SentCallback(); - r = p.begin_opWithPayload(seq, new Callback_TestIntf_opWithPayload() - { - public void - response() - { - } - - public void - exception(Ice.LocalException ex) - { - cb2.ex(ex); - } - - public void - sent(boolean ss) + do + { + final SentCallback cb2 = new SentCallback(); + r = p.begin_opWithPayload(seq, new Callback_TestIntf_opWithPayload() { - cb2.sent(ss); - } - }); - cbs.add(cb2); + public void + response() + { + } + + public void + exception(Ice.LocalException ex) + { + cb2.ex(ex); + } + + public void + sent(boolean ss) + { + cb2.sent(ss); + } + }); + cbs.add(cb2); + } + while(r.sentSynchronously()); + } + finally + { + testController.resumeAdapter(); } - while(r.sentSynchronously()); - testController.resumeAdapter(); for(SentCallback cb3 : cbs) { cb3.check(); @@ -2084,19 +2090,24 @@ public class AllTests out.flush(); { testController.holdAdapter(); - - Ice.AsyncResult r1 = p.begin_op(); - byte[] seq = new byte[10024]; - new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. + Ice.AsyncResult r1; Ice.AsyncResult r2; - while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); - - test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() || - !r1.sentSynchronously() && !r1.isCompleted()); + try + { + r1 = p.begin_op(); + byte[] seq = new byte[10024]; + new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well. + while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); - test(!r2.sentSynchronously() && !r2.isCompleted()); + test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() || + !r1.sentSynchronously() && !r1.isCompleted()); - testController.resumeAdapter(); + test(!r2.sentSynchronously() && !r2.isCompleted()); + } + finally + { + testController.resumeAdapter(); + } r1.waitForSent(); test(r1.isSent()); |