diff options
author | Mark Spruiell <mes@zeroc.com> | 2014-08-15 16:23:00 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2014-08-15 16:23:00 -0700 |
commit | 01f1626babbe190f2d317b56a2a69eb164a00710 (patch) | |
tree | 02ab5fa55dc9f30984a618a76db64b053f8ce88a | |
parent | ICE-5592 - IceSSL.FindCert (SChannel Windows C++ impl) (diff) | |
download | ice-01f1626babbe190f2d317b56a2a69eb164a00710.tar.bz2 ice-01f1626babbe190f2d317b56a2a69eb164a00710.tar.xz ice-01f1626babbe190f2d317b56a2a69eb164a00710.zip |
minor Java edits
-rw-r--r-- | demoscript/Ice/interrupt.py | 35 | ||||
-rw-r--r-- | java/demo/Ice/README | 4 | ||||
-rw-r--r-- | java/demo/Ice/interrupt/README | 43 | ||||
-rwxr-xr-x[-rw-r--r--] | java/demo/Ice/interrupt/expect.py | 0 | ||||
-rw-r--r-- | java/src/Ice/ConnectionI.java | 2 | ||||
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 5 | ||||
-rw-r--r-- | java/test/Ice/interrupt/Test.ice | 8 |
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; }; }; |