diff options
Diffstat (limited to 'java/demo/Ice/nested/Client.java')
-rw-r--r-- | java/demo/Ice/nested/Client.java | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/java/demo/Ice/nested/Client.java b/java/demo/Ice/nested/Client.java index b16a183b257..60264585c7e 100644 --- a/java/demo/Ice/nested/Client.java +++ b/java/demo/Ice/nested/Client.java @@ -11,10 +11,40 @@ import Demo.*; public class Client extends Ice.Application { + class ShutdownHook extends Thread + { + public void + run() + { + /* + * For this demo we won't destroy the communicator since it has to + * wait for any outstanding invocations to complete which may take + * some time if the nesting level is exceeded. + * + try + { + communicator().destroy(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + } + */ + } + } + public int run(String[] args) { - NestedPrx nested = NestedPrxHelper.checkedCast(communicator().propertyToProxy("Nested.Client.NestedServer")); + // + // Since this is an interactive demo we want to clear the + // Application installed interrupt callback and install our + // own shutdown hook. + // + setInterruptHook(new ShutdownHook()); + + NestedPrx nested = NestedPrxHelper.checkedCast( + communicator().propertyToProxy("Nested.Client.NestedServer")); if(nested == null) { System.err.println("invalid proxy"); |