diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-01-04 23:49:10 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-01-04 23:49:10 +0000 |
commit | 4e93c622c6b9d61cc4e1316a7a005df41f8242a9 (patch) | |
tree | 81514c5cafc63c9c67a413732e68815f8a708904 /java/demo/Ice/latency/Server.java | |
parent | bug fix (diff) | |
download | ice-4e93c622c6b9d61cc4e1316a7a005df41f8242a9.tar.bz2 ice-4e93c622c6b9d61cc4e1316a7a005df41f8242a9.tar.xz ice-4e93c622c6b9d61cc4e1316a7a005df41f8242a9.zip |
adding server
Diffstat (limited to 'java/demo/Ice/latency/Server.java')
-rw-r--r-- | java/demo/Ice/latency/Server.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/java/demo/Ice/latency/Server.java b/java/demo/Ice/latency/Server.java new file mode 100644 index 00000000000..6f370b51ff3 --- /dev/null +++ b/java/demo/Ice/latency/Server.java @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +public class Server +{ + private static int + run(String[] args, Ice.Communicator communicator) + { + Ice.ObjectAdapter adapter = + communicator.createObjectAdapter("LatencyAdapter"); + Ice.Object object = new Ping(); + adapter.add(object, Ice.Util.stringToIdentity("ping")); + adapter.activate(); + communicator.waitForShutdown(); + return 0; + } + + public static void + main(String[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.Properties properties = + Ice.Util.createPropertiesFromFile(args, "config"); + communicator = Ice.Util.initializeWithProperties(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); + } +} |