summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demoscript/Ice/interrupt.py35
-rw-r--r--java/demo/Ice/README4
-rw-r--r--java/demo/Ice/interrupt/README43
-rwxr-xr-x[-rw-r--r--]java/demo/Ice/interrupt/expect.py0
-rw-r--r--java/src/Ice/ConnectionI.java2
-rw-r--r--java/src/Ice/ObjectAdapterI.java5
-rw-r--r--java/test/Ice/interrupt/Test.ice8
7 files changed, 67 insertions, 30 deletions
diff --git a/demoscript/Ice/interrupt.py b/demoscript/Ice/interrupt.py
new file mode 100644
index 00000000000..8499c6f68ff
--- /dev/null
+++ b/demoscript/Ice/interrupt.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import sys, time
+import Expect
+
+def runtests(client, server):
+ sys.stdout.write("testing interrupts... ")
+ sys.stdout.flush()
+ client.sendline('b')
+ server.expect('starting task 0')
+ time.sleep(1)
+ client.sendline('i')
+ client.expect('blocking task 0 interrupted')
+ client.sendline('t')
+ server.expect('starting task 1')
+ time.sleep(1)
+ client.sendline('s')
+ client.expect('task 1 completed running')
+ server.expect('interrupted task 0')
+ print("ok")
+
+def run(client, server):
+ runtests(client, server)
+
+ server.waitTestSuccess()
+ client.sendline('x')
+ client.waitTestSuccess()
diff --git a/java/demo/Ice/README b/java/demo/Ice/README
index 368c71269fc..eee5574d335 100644
--- a/java/demo/Ice/README
+++ b/java/demo/Ice/README
@@ -99,5 +99,5 @@ Demos in this directory:
- interrupt
- This demo shows to use Thread.interrupt to interrupt blocking client
- side invocations, and forcably shutdown servers.
+ This demo shows how to use Thread.interrupt to interrupt blocking
+ client-side invocations, and forcibly shutdown servers.
diff --git a/java/demo/Ice/interrupt/README b/java/demo/Ice/interrupt/README
index a28ae716ef2..1e9c183090f 100644
--- a/java/demo/Ice/interrupt/README
+++ b/java/demo/Ice/interrupt/README
@@ -1,6 +1,6 @@
-This demo illustrates how to interrupt blocking servant dispatches on the server
-and interrupt blocking proxy invocations on the client by using
-java.lang.Thread.interrupt.
+This demo illustrates how to interrupt blocking servant dispatches on
+the server and interrupt blocking proxy invocations on the client by
+using Thread.interrupt().
To run the demo, first start the server:
@@ -10,27 +10,28 @@ In a separate window, start the client:
$ java Client
-Calling TaskManager::run on the server simulates a long running task by sleeping
-10 seconds. Ordinarily a server will not shutdown until all executing dispatched
-requests are complete. By interrupting dispatch threads using
-java.lang.Thread.interrupt a server shutdown will proceed, as long as the
-servant implementation correctly handles the interrupt.
+Calling TaskManager::run on the server simulates a long running task
+by sleeping 10 seconds. Ordinarily a server will not shutdown until
+all executing dispatched requests are complete. By interrupting
+dispatch threads using Thread.interrupt() a server shutdown will
+proceed, as long as the servant implementation correctly handles the
+interrupt.
-The simplest way to interrupt method dispatch threads is through the use of an
-Ice.Dispatcher and ExecutorService. Calling shutdownNow on the ExecutorService
-interrupts any executing tasks.
+The simplest way to interrupt dispatch threads is by using an
+Ice.Dispatcher and ExecutorService. Calling shutdownNow on the
+ExecutorService interrupts any executing tasks.
-Pressing ^C in the server calls shutdownNow on the executor service, as does
-pressing 's' in the Client which calls TaskManager::shutdown, the implementation
-of which itself calls shutdownNow.
+Pressing ^C in the server calls shutdownNow on the executor service,
+as does pressing 's' in the client which calls TaskManager::shutdown,
+the implementation of which itself calls shutdownNow.
-It is also possible to interrupt blocking invocations on an Ice proxy through
-the use of java.lang.Thread.interrupt.
+It is also possible to interrupt blocking invocations on an Ice proxy
+by calling Thread.interrupt().
-In this demo, to interrupt a blocking proxy invocation on the client press 'b'
-to run the invocation, and 'i' to interrupt the invocation. Only a single
-blocking can be active at once.
+In this demo, to interrupt a blocking proxy invocation on the client
+press 'b' to run the invocation and 'i' to interrupt the invocation.
+Only a single blocking invocation can be active at once.
-Pressing 't' in the client runs the task on the server using a non-blocking AMI
-invocation.
+Pressing 't' in the client runs the task on the server using a
+non-blocking AMI invocation.
diff --git a/java/demo/Ice/interrupt/expect.py b/java/demo/Ice/interrupt/expect.py
index 65797c9a5ba..65797c9a5ba 100644..100755
--- a/java/demo/Ice/interrupt/expect.py
+++ b/java/demo/Ice/interrupt/expect.py
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index c835e398735..b304efa82b5 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -3076,7 +3076,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
//
// This is similar to a mutex lock in that the flag is
// only true for a short time period. As such we don't permit the
- // wait to be interrupted. Instead the interrupted status is saved\
+ // wait to be interrupted. Instead the interrupted status is saved
// and restored.
//
boolean interrupted = false;
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java
index c3ab836967c..82841fdf67c 100644
--- a/java/src/Ice/ObjectAdapterI.java
+++ b/java/src/Ice/ObjectAdapterI.java
@@ -1640,11 +1640,12 @@ public final class ObjectAdapterI implements ObjectAdapter
return noProps;
}
- private enum DeactivatedState {
+ private enum DeactivatedState
+ {
Steady,
Deactivating,
Deactivated
- };
+ }
private DeactivatedState _deactivated;
private IceInternal.Instance _instance;
private Communicator _communicator;
diff --git a/java/test/Ice/interrupt/Test.ice b/java/test/Ice/interrupt/Test.ice
index 1c636847e15..ad98079dcda 100644
--- a/java/test/Ice/interrupt/Test.ice
+++ b/java/test/Ice/interrupt/Test.ice
@@ -24,7 +24,7 @@ interface TestIntf
void op();
void sleep(int to)
throws InterruptedException;
- void opWithPayload(Ice::ByteSeq seq);
+ void opWithPayload(Ice::ByteSeq seq);
void shutdown();
};
@@ -34,10 +34,10 @@ exception CannotInterruptException
interface TestIntfController
{
- void holdAdapter();
+ void holdAdapter();
void resumeAdapter();
- void interrupt()
- throws CannotInterruptException;
+ void interrupt()
+ throws CannotInterruptException;
};
};