diff options
Diffstat (limited to 'cpp/demo/Freeze/phonebook/Server.cpp')
-rw-r--r-- | cpp/demo/Freeze/phonebook/Server.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/cpp/demo/Freeze/phonebook/Server.cpp b/cpp/demo/Freeze/phonebook/Server.cpp index ad35aead066..6e1ca0fca9c 100644 --- a/cpp/demo/Freeze/phonebook/Server.cpp +++ b/cpp/demo/Freeze/phonebook/Server.cpp @@ -47,9 +47,16 @@ PhoneBookServer::run(int argc, char* argv[]) PropertiesPtr properties = communicator()->getProperties(); // + // Create the name index. + // + NameIndexPtr index = new NameIndex("name"); + vector<Freeze::IndexPtr> indices; + indices.push_back(index); + + // // Create an evictor for contacts. // - Freeze::EvictorPtr evictor = Freeze::createEvictor(communicator(), _envName, "contacts"); + Freeze::EvictorPtr evictor = Freeze::createEvictor(communicator(), _envName, "contacts", indices); Int evictorSize = properties->getPropertyAsInt("PhoneBook.EvictorSize"); if(evictorSize > 0) @@ -66,16 +73,14 @@ PhoneBookServer::run(int argc, char* argv[]) // // Create the phonebook, and add it to the object adapter. // - PhoneBookIPtr phoneBook = new PhoneBookI(communicator(), _envName, "phonebook", evictor); + PhoneBookIPtr phoneBook = new PhoneBookI(evictor, index); adapter->add(phoneBook, stringToIdentity("phonebook")); // - // Create and install a factory and initializer for contacts. + // Create and install a factory for contacts. // - ObjectFactoryPtr contactFactory = new ContactFactory(phoneBook, evictor); - ServantInitializerPtr contactInitializer = ServantInitializerPtr::dynamicCast(contactFactory); + ObjectFactoryPtr contactFactory = new ContactFactory(evictor); communicator()->addObjectFactory(contactFactory, "::Contact"); - evictor->installServantInitializer(contactInitializer); // // Everything ok, let's go. |