vgritsenko 2003/08/12 08:50:40
Modified: src/java/org/apache/cocoon/components/store/impl
DefaultStore.java
. status.xml
Log:
Fix jisp store impl: reuse index file
Revision Changes Path
1.5 +32 -5
cocoon-2.1/src/java/org/apache/cocoon/components/store/impl/DefaultStore.java
Index: DefaultStore.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/store/impl/DefaultStore.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultStore.java 26 Jul 2003 15:17:25 -0000 1.4
+++ DefaultStore.java 12 Aug 2003 15:50:40 -0000 1.5
@@ -57,6 +57,7 @@
import com.coyotegulch.jisp.IndexedObjectDatabase;
import com.coyotegulch.jisp.KeyNotFound;
+import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
@@ -81,7 +82,8 @@
implements org.apache.excalibur.store.Store,
Contextualizable,
ThreadSafe,
- Parameterizable {
+ Parameterizable,
+ Disposable {
/** The context containing the work and the cache directory */
protected Context context;
@@ -169,9 +171,17 @@
if (getLogger().isDebugEnabled()) {
getLogger().debug("Datafile exists: " + databaseExists);
}
- super.m_Database = new
IndexedObjectDatabase(databaseFile.toString(), !databaseExists);
- super.m_Index = new BTreeIndex(indexFile.toString(),
- order, this.getNullKey(), false);
+ super.m_Database = new
IndexedObjectDatabase(databaseFile.toString(),
+ !databaseExists);
+
+ if (!databaseExists) {
+ // Create new index
+ super.m_Index = new BTreeIndex(indexFile.toString(),
+ order, super.getNullKey(),
false);
+ } else {
+ // Open existing index
+ super.m_Index = new BTreeIndex(indexFile.toString());
+ }
super.m_Database.attachIndex(super.m_Index);
} catch (KeyNotFound ignore) {
} catch (Exception e) {
@@ -179,4 +189,21 @@
}
}
+ public void dispose() {
+ try {
+ getLogger().debug("Disposing");
+
+ if (super.m_Index != null) {
+ System.out.println("-------------- DISPOSING
--------------");
+ super.m_Index.dumpTree(System.out);
+ super.m_Index.close();
+ }
+
+ if (super.m_Database != null) {
+ super.m_Database.close();
+ }
+ } catch (Exception e) {
+ getLogger().error("dispose(..) Exception", e);
+ }
+ }
}
1.117 +7 -3 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- status.xml 12 Aug 2003 15:48:02 -0000 1.116
+++ status.xml 12 Aug 2003 15:50:40 -0000 1.117
@@ -202,6 +202,10 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="VG" type="fix">
+ Fix Jisp based persistent store: close database files on Cocoon
shutdown and
+ re-use existing database and index files on startup.
+ </action>
<action dev="SW" type="fix" fixes-bug="22239">
Views are now always loaded before resources, ensuring proper call of
views from resources.
Redeclaring a component (e.g. file generator) with no "label" attribute
was wrongly inheriting
@@ -210,10 +214,10 @@
</release>
<release version="2.1" date="August 12 2003">
<action dev="JH" type="update" fixes-bug="22288" due-to="Mark Leicester"
due-to-email="[EMAIL PROTECTED]">
- midi block refactoring applied.
+ Midi block refactoring applied.
</action>
<action dev="CZ" type="add" fixes-bug="22270" due-to="Unico Hommes"
due-to-email="[EMAIL PROTECTED]">
- Patch for allowing to specify a cocoon-view for internal requests in the
query string.
+ Patch for allowing to specify a cocoon-view for internal requests in the
query string.
</action>
<action dev="JH" type="fix" fixes-bug="19839">
Instrumentation support: Updated client libraries to make
instrumentation work again.