summaryrefslogtreecommitdiff
path: root/java/src/IceBox/Server.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2002-08-09 14:47:51 +0000
committerBenoit Foucher <benoit@zeroc.com>2002-08-09 14:47:51 +0000
commit8774379a65a2f03c22bd57a9f601ca2d65921acf (patch)
treeed4e80924ed87bacc30e9140470735d5eee5ef78 /java/src/IceBox/Server.java
parentAdded new IcePack test suite, add IcePack tracing properties, added IcePack (diff)
downloadice-8774379a65a2f03c22bd57a9f601ca2d65921acf.tar.bz2
ice-8774379a65a2f03c22bd57a9f601ca2d65921acf.tar.xz
ice-8774379a65a2f03c22bd57a9f601ca2d65921acf.zip
Added Ice application shutdown hook. Fixed IceBox to use Ice Application.
Added new IcePack deployer test suite.
Diffstat (limited to 'java/src/IceBox/Server.java')
-rw-r--r--java/src/IceBox/Server.java77
1 files changed, 28 insertions, 49 deletions
diff --git a/java/src/IceBox/Server.java b/java/src/IceBox/Server.java
index 2262e3ef5a1..8e21e76fa59 100644
--- a/java/src/IceBox/Server.java
+++ b/java/src/IceBox/Server.java
@@ -10,7 +10,7 @@
package IceBox;
-public final class Server
+public final class Server extends Ice.Application
{
private static void
usage()
@@ -25,54 +25,33 @@ public final class Server
public static void
main(String[] args)
{
- Ice.Communicator communicator = null;
- int status = 0;
-
- try
- {
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- communicator = Ice.Util.initialize(argsH);
-
- Ice.Properties properties = communicator.getProperties();
- argsH.value = properties.parseCommandLineOptions("IceBox", argsH.value);
-
- for(int i = 1; i < argsH.value.length; ++i)
- {
- if(argsH.value[i].equals("-h") || argsH.value[i].equals("--help"))
- {
- usage();
- System.exit(0);
- }
- else if(!argsH.value[i].startsWith("--"))
- {
- System.err.println("Server: unknown option `" + argsH.value[i] + "'");
- usage();
- System.exit(1);
- }
- }
-
- ServiceManagerI serviceManagerImpl = new ServiceManagerI(communicator, argsH.value);
- status = serviceManagerImpl.run();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- status = 1;
- }
- }
+ Server server = new Server();
+ server.main("IceBox.Server", args);
+ }
- System.exit(status);
+ public int
+ run(String[] args)
+ {
+ Ice.Properties properties = communicator().getProperties();
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ argsH.value = properties.parseCommandLineOptions("IceBox", argsH.value);
+
+ for(int i = 1; i < argsH.value.length; ++i)
+ {
+ if(argsH.value[i].equals("-h") || argsH.value[i].equals("--help"))
+ {
+ usage();
+ return 0;
+ }
+ else if(!argsH.value[i].startsWith("--"))
+ {
+ System.err.println("Server: unknown option `" + argsH.value[i] + "'");
+ usage();
+ return 1;
+ }
+ }
+
+ ServiceManagerI serviceManagerImpl = new ServiceManagerI(this, argsH.value);
+ return serviceManagerImpl.run();
}
}