summaryrefslogtreecommitdiff
path: root/java/demo/Ice/throughput/Client.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/demo/Ice/throughput/Client.java')
-rw-r--r--java/demo/Ice/throughput/Client.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/java/demo/Ice/throughput/Client.java b/java/demo/Ice/throughput/Client.java
index 99bfdcef97a..1d926a71b0a 100644
--- a/java/demo/Ice/throughput/Client.java
+++ b/java/demo/Ice/throughput/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()
{
@@ -38,6 +54,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());
+
Ice.ObjectPrx base = communicator().propertyToProxy("Throughput.Throughput");
ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(base);
if(throughput == null)