summaryrefslogtreecommitdiff
path: root/java/demo/Ice/hello/Client.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/demo/Ice/hello/Client.java')
-rw-r--r--java/demo/Ice/hello/Client.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/java/demo/Ice/hello/Client.java b/java/demo/Ice/hello/Client.java
index df647df390e..67fd95e2d3e 100644
--- a/java/demo/Ice/hello/Client.java
+++ b/java/demo/Ice/hello/Client.java
@@ -11,6 +11,22 @@ import Demo.*;
public class Client extends Ice.Application
{
+ class ShutdownHook extends Thread
+ {
+ public void
+ run()
+ {
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
private static void
menu()
{
@@ -33,6 +49,13 @@ public class Client extends Ice.Application
public int
run(String[] args)
{
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ setInterruptHook(new ShutdownHook());
+
HelloPrx twoway = HelloPrxHelper.checkedCast(
communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
if(twoway == null)
@@ -206,3 +229,4 @@ public class Client extends Ice.Application
System.exit(status);
}
}
+