diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-09-13 02:25:11 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-09-13 02:25:11 +0000 |
commit | 13c1478b4bf220e3c08055f7af39281e2f5d8875 (patch) | |
tree | 2d80b77591f870688270b6637678eddb3e1c6196 /java/demo/IceBox/hello/Client.java | |
parent | updates. (diff) | |
download | ice-13c1478b4bf220e3c08055f7af39281e2f5d8875.tar.bz2 ice-13c1478b4bf220e3c08055f7af39281e2f5d8875.tar.xz ice-13c1478b4bf220e3c08055f7af39281e2f5d8875.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=335
Diffstat (limited to 'java/demo/IceBox/hello/Client.java')
-rw-r--r-- | java/demo/IceBox/hello/Client.java | 49 |
1 files changed, 11 insertions, 38 deletions
diff --git a/java/demo/IceBox/hello/Client.java b/java/demo/IceBox/hello/Client.java index 851826753ed..c89be59d095 100644 --- a/java/demo/IceBox/hello/Client.java +++ b/java/demo/IceBox/hello/Client.java @@ -9,9 +9,9 @@ import Demo.*; -public class Client +public class Client extends Ice.Application { - private static void + private void menu() { System.out.println( @@ -27,10 +27,10 @@ public class Client "?: help\n"); } - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); final String refProperty = "Hello.Hello"; String ref = properties.getProperty(refProperty); if(ref.length() == 0) @@ -39,8 +39,8 @@ public class Client return 1; } - Ice.ObjectPrx base = communicator.stringToProxy(ref); - HelloPrx twoway = HelloPrxHelper.checkedCast(base.ice_twoway().ice_timeout(-1).ice_secure(false)); + HelloPrx twoway = HelloPrxHelper.checkedCast( + communicator().stringToProxy(ref).ice_twoway().ice_timeout(-1).ice_secure(false)); if(twoway == null) { System.err.println("invalid object reference"); @@ -91,7 +91,7 @@ public class Client } else if(line.equals("f")) { - communicator.flushBatchRequests(); + communicator().flushBatchRequests(); } else if(line.equals("T")) { @@ -148,35 +148,8 @@ public class Client public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.Properties properties = Ice.Util.createProperties(); - properties.load("config"); - communicator = Ice.Util.initializeWithProperties(args, properties); - status = run(args, communicator); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.exit(status); + Client app = new Client(); + int status = app.main("Client", args, "config"); + System.exit(status); } } |