diff options
Diffstat (limited to 'java/demo/Freeze/phonebook/Server.java')
-rw-r--r-- | java/demo/Freeze/phonebook/Server.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/java/demo/Freeze/phonebook/Server.java b/java/demo/Freeze/phonebook/Server.java index bb105f4a0d3..b8658a87726 100644 --- a/java/demo/Freeze/phonebook/Server.java +++ b/java/demo/Freeze/phonebook/Server.java @@ -20,12 +20,19 @@ class PhoneBookServer extends Ice.Application Ice.Properties properties = communicator().getProperties(); // + // Create and install a factory and initializer for contacts. + // + ContactFactory contactFactory = new ContactFactory(); + communicator().addObjectFactory(contactFactory, "::Contact"); + + // // Create the name index. // NameIndex index = new NameIndex("name"); Freeze.Index[] indices = new Freeze.Index[1]; indices[0] = index; + // // Create an evictor for contacts. // @@ -37,6 +44,11 @@ class PhoneBookServer extends Ice.Application } // + // Set the evictor in the contact factory + // + contactFactory.setEvictor(evictor); + + // // Create an object adapter, use the evictor as servant // locator. // @@ -46,14 +58,9 @@ class PhoneBookServer extends Ice.Application // // Create the phonebook, and add it to the object adapter. // - PhoneBookI phoneBook = new PhoneBookI(evictor, index); + PhoneBookI phoneBook = new PhoneBookI(evictor, contactFactory, index); adapter.add(phoneBook, Ice.Util.stringToIdentity("phonebook")); - // - // Create and install a factory and initializer for contacts. - // - Ice.ObjectFactory contactFactory = new ContactFactory(evictor); - communicator().addObjectFactory(contactFactory, "::Contact"); // // Everything ok, let's go. |