diff options
Diffstat (limited to 'java/demo/book/map_filesystem/Server.java')
-rw-r--r-- | java/demo/book/map_filesystem/Server.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/java/demo/book/map_filesystem/Server.java b/java/demo/book/map_filesystem/Server.java index da9ce6e8617..e7851806949 100644 --- a/java/demo/book/map_filesystem/Server.java +++ b/java/demo/book/map_filesystem/Server.java @@ -21,6 +21,7 @@ public class Server extends Ice.Application public int run(String[] args) { + // // Create an object adapter // Ice.ObjectAdapter adapter = communicator().createObjectAdapter("MapFilesystem"); @@ -28,35 +29,40 @@ public class Server extends Ice.Application Freeze.Connection connection = null; try { + // // Open a connection to the files and directories // database. This should remain open for the duration of the // application for performance reasons. // connection = Freeze.Util.createConnection(communicator(), _envName); - IdentityFileEntryMap fileDB = new IdentityFileEntryMap(connection, FileI.filesDB(), true); + IdentityFileEntryMap fileDB = new IdentityFileEntryMap(connection, FileI.filesDB(), true); IdentityDirectoryEntryMap dirDB = new IdentityDirectoryEntryMap( - connection, DirectoryI.directoriesDB(), true); - + connection, DirectoryI.directoriesDB(), true); + + // // Add default servants for the file and directory. // adapter.addDefaultServant(new FileI(communicator(), _envName), "file"); adapter.addDefaultServant(new DirectoryI(communicator(), _envName), ""); - + + // // Ready to accept requests now // adapter.activate(); - + + // // Wait until we are done // communicator().waitForShutdown(); } finally { + // // Close the connection gracefully. // connection.close(); } - + return 0; } |