summaryrefslogtreecommitdiff
path: root/java/demo/Freeze/library/Collocated.java
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 /java/demo/Freeze/library/Collocated.java
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 'java/demo/Freeze/library/Collocated.java')
-rw-r--r--java/demo/Freeze/library/Collocated.java29
1 files changed, 10 insertions, 19 deletions
diff --git a/java/demo/Freeze/library/Collocated.java b/java/demo/Freeze/library/Collocated.java
index 1eeab28e45b..23490847fee 100644
--- a/java/demo/Freeze/library/Collocated.java
+++ b/java/demo/Freeze/library/Collocated.java
@@ -12,29 +12,17 @@
//
// **********************************************************************
-class LibraryCollocated extends Freeze.Application
+class LibraryCollocated extends Ice.Application
{
public int
- runFreeze(String[] args, Freeze.DBEnvironment dbEnv)
+ run(String[] args)
{
Ice.Properties properties = communicator().getProperties();
-
- Freeze.DB dbBooks = dbEnv.openDB("books", true);
- Freeze.DB dbAuthors = dbEnv.openDB("authors", true);
-
+
//
// Create an Evictor for books.
//
- Freeze.PersistenceStrategy strategy;
- if(properties.getPropertyAsInt("Library.IdleStrategy") > 0)
- {
- strategy = dbBooks.createIdleStrategy();
- }
- else
- {
- strategy = dbBooks.createEvictionStrategy();
- }
- Freeze.Evictor evictor = dbBooks.createEvictor(strategy);
+ Freeze.Evictor evictor = Freeze.Util.createEvictor(communicator(), _envName, "books", true);
int evictorSize = properties.getPropertyAsInt("Library.EvictorSize");
if(evictorSize > 0)
{
@@ -51,7 +39,7 @@ class LibraryCollocated extends Freeze.Application
//
// Create the library, and add it to the Object Adapter.
//
- LibraryI library = new LibraryI(dbAuthors, evictor);
+ LibraryI library = new LibraryI(communicator(), _envName, "authors", evictor);
adapter.add(library, Ice.Util.stringToIdentity("library"));
//
@@ -67,13 +55,16 @@ class LibraryCollocated extends Freeze.Application
adapter.deactivate();
adapter.waitForDeactivate();
+ library.close();
return status;
}
- LibraryCollocated(String dbEnvName)
+ LibraryCollocated(String envName)
{
- super(dbEnvName);
+ _envName = envName;
}
+
+ private String _envName;
}
public class Collocated