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.java45
1 files changed, 9 insertions, 36 deletions
diff --git a/java/demo/Ice/hello/Client.java b/java/demo/Ice/hello/Client.java
index ed4b39b89ca..ba39718b957 100644
--- a/java/demo/Ice/hello/Client.java
+++ b/java/demo/Ice/hello/Client.java
@@ -9,7 +9,7 @@
import Demo.*;
-public class Client
+public class Client extends Ice.Application
{
private static void
menu()
@@ -29,10 +29,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 proxyProperty = "Hello.Proxy";
String proxy = properties.getProperty(proxyProperty);
if(proxy.length() == 0)
@@ -41,8 +41,8 @@ public class Client
return 1;
}
- Ice.ObjectPrx base = communicator.stringToProxy(proxy);
- HelloPrx twoway = HelloPrxHelper.checkedCast(base.ice_twoway().ice_timeout(-1).ice_secure(false));
+ HelloPrx twoway = HelloPrxHelper.checkedCast(
+ communicator().stringToProxy(proxy).ice_twoway().ice_timeout(-1).ice_secure(false));
if(twoway == null)
{
System.err.println("invalid proxy");
@@ -108,7 +108,7 @@ public class Client
}
else if(line.equals("f"))
{
- communicator.flushBatchRequests();
+ communicator().flushBatchRequests();
}
else if(line.equals("T"))
{
@@ -188,35 +188,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;
- }
- }
-
+ Client app = new Client();
+ int status = app.main("Client", args, "config");
System.exit(status);
}
}