diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/src/IceInternal/Outgoing.java | 15 | ||||
-rw-r--r-- | java/src/IceInternal/PropertyNames.java | 3 | ||||
-rw-r--r-- | java/test/Ice/interrupt/AllTests.java | 64 |
3 files changed, 70 insertions, 12 deletions
diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java index 545f8f79800..eec1e4eb8f0 100644 --- a/java/src/IceInternal/Outgoing.java +++ b/java/src/IceInternal/Outgoing.java @@ -107,7 +107,7 @@ public final class Outgoing implements OutgoingMessageCallback } catch(Ice.OperationInterruptedException ex) { - if(_handler.requestCanceled(this, new Ice.OperationInterruptedException())) + if(_handler.requestCanceled(this, ex)) { // // Wait for the exception to propagate. It's possible the request handler ignores @@ -134,6 +134,10 @@ public final class Outgoing implements OutgoingMessageCallback } } } + else + { + throw ex; + } } boolean timedOut = false; @@ -183,7 +187,8 @@ public final class Outgoing implements OutgoingMessageCallback if(timedOut) { - if(_handler.requestCanceled(this, new Ice.InvocationTimeoutException())) + Ice.InvocationTimeoutException ex = new Ice.InvocationTimeoutException(); + if(_handler.requestCanceled(this, ex)) { // // Wait for the exception to propagate. It's possible the request handler ignores @@ -199,7 +204,7 @@ public final class Outgoing implements OutgoingMessageCallback { wait(); } - catch(InterruptedException ex) + catch(InterruptedException e) { interrupted = true; } @@ -210,6 +215,10 @@ public final class Outgoing implements OutgoingMessageCallback } } } + else + { + throw ex; + } } if(_exception != null) diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java index 13b03bc9b20..0d80e319830 100644 --- a/java/src/IceInternal/PropertyNames.java +++ b/java/src/IceInternal/PropertyNames.java @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Wed Aug 13 09:11:52 2014 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Wed Aug 13 15:11:58 2014 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -179,6 +179,7 @@ public final class PropertyNames new Property("Ice\\.Warn\\.UnknownProperties", false, null), new Property("Ice\\.Warn\\.UnusedProperties", false, null), new Property("Ice\\.CacheMessageBuffers", false, null), + new Property("Ice\\.BackgroundIO", false, null), null }; diff --git a/java/test/Ice/interrupt/AllTests.java b/java/test/Ice/interrupt/AllTests.java index 69644e735b0..bab1865f1cb 100644 --- a/java/test/Ice/interrupt/AllTests.java +++ b/java/test/Ice/interrupt/AllTests.java @@ -31,7 +31,6 @@ public class AllTests { CallbackBase() { - _called = false; } public synchronized void check() @@ -57,7 +56,31 @@ public class AllTests notify(); } - private boolean _called; + public synchronized void checkResponse() + { + while(!_response) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } + + _response = false; + } + + public synchronized void response() + { + assert(!_response); + _response = true; + notify(); + } + + private boolean _called = false; + private boolean _response = false; } private static void @@ -93,7 +116,13 @@ public class AllTests try { p.op(); - test(false); + // + // It is possible that the thread isn't interrupted. However, it shouldn't + // be possible for the call to return and the interrupt swallowed. + // + test(mainThread.isInterrupted()); + // Clear the interrupt at this point. + Thread.interrupted(); } catch(Ice.OperationInterruptedException ex) { @@ -102,13 +131,15 @@ public class AllTests final CallbackBase cb = new CallbackBase(); mainThread.interrupt(); + final boolean responseCalled[] = new boolean[1]; + responseCalled[0] = false; p.begin_sleep(500, new Callback_TestIntf_sleep() { - @Override public void response() { - test(false); + responseCalled[1] = true; + cb.called(); } @Override @@ -124,7 +155,20 @@ public class AllTests test(false); } }); + boolean interrupted = false; + if(mainThread.isInterrupted()) + { + // + // The AMI request will receive a response. + // + Thread.interrupted(); + interrupted = true; + } cb.check(); + if(interrupted) + { + test(responseCalled[0]); + } ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(1); executor.submit(new Runnable() { @@ -162,7 +206,7 @@ public class AllTests try { - Ice.AsyncResult r = p.begin_op(); + Ice.AsyncResult r = p.begin_sleep(250); Thread.currentThread().interrupt(); r.waitForCompleted(); test(false); @@ -174,15 +218,19 @@ public class AllTests try { - Ice.AsyncResult r = p.begin_op(); + Ice.AsyncResult r = p.begin_sleep(250); Thread.currentThread().interrupt(); - p.end_op(r); + p.end_sleep(r); test(false); } catch(Ice.OperationInterruptedException ex) { // Expected } + catch(test.Ice.interrupt.Test.InterruptedException e) + { + test(false); + } // // Test interrupt of waitForSent. Here hold the adapter and send a large payload. The |