diff options
Diffstat (limited to 'java/demo/manual/lifecycle/Server.java')
-rw-r--r-- | java/demo/manual/lifecycle/Server.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/java/demo/manual/lifecycle/Server.java b/java/demo/manual/lifecycle/Server.java new file mode 100644 index 00000000000..2a5fe5d103a --- /dev/null +++ b/java/demo/manual/lifecycle/Server.java @@ -0,0 +1,60 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2014 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 FilesystemI.*; + +class Server extends Ice.Application +{ + @Override + public int + run(String[] args) + { + // + // Terminate cleanly on receipt of a signal. + // + shutdownOnInterrupt(); + + // + // Create an object adapter + // + Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints( + "LifecycleFilesystem", "default -h localhost -p 10000"); + + // + // Create the root directory. + // + DirectoryI root = new DirectoryI(); + Ice.Identity id = new Ice.Identity(); + id.name = "RootDir"; + adapter.add(root, id); + + // + // All objects are created, allow client requests now. + // + adapter.activate(); + + // + // Wait until we are done. + // + communicator().waitForShutdown(); + if(interrupted()) + { + System.err.println(appName() + ": received signal, shutting down"); + } + + return 0; + } + + static public void + main(String[] args) + { + Server app = new Server(); + app.main("demo.book.lifecycle.Server", args); + } +} |