diff options
Diffstat (limited to 'java/demo/Ice/minimal/Server.java')
-rwxr-xr-x | java/demo/Ice/minimal/Server.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/java/demo/Ice/minimal/Server.java b/java/demo/Ice/minimal/Server.java new file mode 100755 index 00000000000..ce13d72873d --- /dev/null +++ b/java/demo/Ice/minimal/Server.java @@ -0,0 +1,58 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +import Demo.*; + +public class Server +{ + public static int + run(String[] args, Ice.Communicator communicator) + { + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Hello"); + adapter.add(new HelloI(), Ice.Util.stringToIdentity("hello")); + 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.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); + } +} |