summaryrefslogtreecommitdiff
path: root/cpp/demo/Freeze/library/Server.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2003-07-18 19:47:14 +0000
committerBernard Normier <bernard@zeroc.com>2003-07-18 19:47:14 +0000
commit3c02842b6143c6ce9297feecd7c9497312c76da8 (patch)
tree478210bed985772e2957ee0a65b9cd3f5f390234 /cpp/demo/Freeze/library/Server.cpp
parentuse lazy initialization of communicator for each request (diff)
downloadice-3c02842b6143c6ce9297feecd7c9497312c76da8.tar.bz2
ice-3c02842b6143c6ce9297feecd7c9497312c76da8.tar.xz
ice-3c02842b6143c6ce9297feecd7c9497312c76da8.zip
Major Freeze update
Diffstat (limited to 'cpp/demo/Freeze/library/Server.cpp')
-rw-r--r--cpp/demo/Freeze/library/Server.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/cpp/demo/Freeze/library/Server.cpp b/cpp/demo/Freeze/library/Server.cpp
index 1d905a47e04..b828c4e4454 100644
--- a/cpp/demo/Freeze/library/Server.cpp
+++ b/cpp/demo/Freeze/library/Server.cpp
@@ -12,23 +12,28 @@
//
// **********************************************************************
-#include <Freeze/Application.h>
+#include <Ice/Application.h>
#include <BookFactory.h>
+#include <Freeze/Freeze.h>
using namespace std;
using namespace Ice;
using namespace Freeze;
-class LibraryServer : public Freeze::Application
+class LibraryServer : public Ice::Application
{
public:
- LibraryServer(const string& dbEnvName) :
- Freeze::Application(dbEnvName)
+ LibraryServer(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
@@ -39,26 +44,15 @@ main(int argc, char* argv[])
}
int
-LibraryServer::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbEnv)
+LibraryServer::run(int argc, char* argv[])
{
PropertiesPtr properties = communicator()->getProperties();
-
- 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)
{
@@ -74,7 +68,7 @@ LibraryServer::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbEnv)
//
// 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"));
//