diff options
author | Bernard Normier <bernard@zeroc.com> | 2003-07-18 19:47:14 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2003-07-18 19:47:14 +0000 |
commit | 3c02842b6143c6ce9297feecd7c9497312c76da8 (patch) | |
tree | 478210bed985772e2957ee0a65b9cd3f5f390234 /cpp/demo/Freeze/library/Collocated.cpp | |
parent | use lazy initialization of communicator for each request (diff) | |
download | ice-3c02842b6143c6ce9297feecd7c9497312c76da8.tar.bz2 ice-3c02842b6143c6ce9297feecd7c9497312c76da8.tar.xz ice-3c02842b6143c6ce9297feecd7c9497312c76da8.zip |
Major Freeze update
Diffstat (limited to 'cpp/demo/Freeze/library/Collocated.cpp')
-rw-r--r-- | cpp/demo/Freeze/library/Collocated.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/cpp/demo/Freeze/library/Collocated.cpp b/cpp/demo/Freeze/library/Collocated.cpp index c2065b9d420..86319dac05c 100644 --- a/cpp/demo/Freeze/library/Collocated.cpp +++ b/cpp/demo/Freeze/library/Collocated.cpp @@ -12,24 +12,28 @@ // // ********************************************************************** -#include <Freeze/Application.h> +#include <Ice/Application.h> #include <BookFactory.h> #include <Parser.h> +#include <Freeze/Freeze.h> using namespace std; using namespace Ice; using namespace Freeze; -class LibraryCollocated : public Freeze::Application +class LibraryCollocated : public Ice::Application { public: - LibraryCollocated(const string& dbEnvName) : - Freeze::Application(dbEnvName) + LibraryCollocated(const string& envName) : + _envName(envName) { } - virtual int runFreeze(int argc, char* argv[], const DBEnvironmentPtr&); + virtual int run(int argc, char* argv[]); + +private: + const string _envName; }; int @@ -40,27 +44,16 @@ main(int argc, char* argv[]) } int -LibraryCollocated::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbEnv) +LibraryCollocated::run(int argc, char* argv[]) { PropertiesPtr properties = communicator()->getProperties(); string value; - DBPtr dbBooks = dbEnv->openDB("books", true); - DBPtr dbAuthors = dbEnv->openDB("authors", true); - // // Create an Evictor for books. - // - PersistenceStrategyPtr strategy; - if(properties->getPropertyAsInt("Library.IdleStrategy") > 0) - { - strategy = dbBooks->createIdleStrategy(); - } - else - { - strategy = dbBooks->createEvictionStrategy(); - } - Freeze::EvictorPtr evictor = dbBooks->createEvictor(strategy); + // + Freeze::EvictorPtr evictor = Freeze::createEvictor(communicator(), _envName, "books"); + Int evictorSize = properties->getPropertyAsInt("Library.EvictorSize"); if(evictorSize > 0) { @@ -76,7 +69,7 @@ LibraryCollocated::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbE // // Create the library, and add it to the Object Adapter. // - LibraryIPtr library = new LibraryI(dbAuthors, evictor); + LibraryIPtr library = new LibraryI(communicator(), _envName, "authors", evictor); adapter->add(library, stringToIdentity("library")); // |