You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2007/04/05 15:33:41 UTC
svn commit: r525824 - in
/cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main:
java/org/apache/cocoon/components/store/impl/
resources/META-INF/cocoon/spring/
Author: reinhard
Date: Thu Apr 5 06:33:39 2007
New Revision: 525824
URL: http://svn.apache.org/viewvc?view=rev&rev=525824
Log:
- make the use of StoreJanitor optional for StoreJanitor
- Store and TransientStore are configured to use StoreJanitor by default but you the
configuration can be overriden easily
(--> changing this requires a vote IMO)
Modified:
cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-ehcache.xml
cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-transient.xml
Modified: cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java?view=diff&rev=525824&r1=525823&r2=525824
==============================================================================
--- cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java (original)
+++ cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java Thu Apr 5 06:33:39 2007
@@ -39,6 +39,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.excalibur.store.Store;
+import org.apache.excalibur.store.StoreJanitor;
/**
* <p>Store implementation based on EHCache (http://ehcache.sourceforge.net/)
@@ -128,6 +129,7 @@
private BootstrapCacheLoader bootstrapCacheLoader = null;
private Settings settings;
+ private StoreJanitor storeJanitor;
private String cacheName;
private String directory;
private File workDir;
@@ -266,6 +268,14 @@
public void setSettings(Settings settings) {
this.settings = settings;
}
+
+ /**
+ * Use the {@link StoreJanitor} to take care of freeing memory.
+ * @param storeJanitor
+ */
+ public void setStoreJanitor(StoreJanitor storeJanitor) {
+ this.storeJanitor = storeJanitor;
+ }
public Log getLogger() {
return this.logger;
@@ -384,9 +394,11 @@
this.registeredEventListeners,
this.bootstrapCacheLoader,
this.maxDiskObjects);
-
this.cacheManager.addCache(this.cache);
+ if(this.storeJanitor != null) {
+ storeJanitor.register(this);
+ }
getLogger().info("EHCache cache \"" + this.cacheName + "\" initialized");
}
@@ -394,6 +406,9 @@
* Shutdown the CacheManager.
*/
public void destroy() {
+ if(this.storeJanitor != null) {
+ storeJanitor.unregister(this);
+ }
/*
* EHCache can be a bitch when shutting down. Basically every cache registers
* a hook in the Runtime for every persistent cache, that will be executed when
Modified: cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-ehcache.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-ehcache.xml?view=diff&rev=525824&r1=525823&r2=525824
==============================================================================
--- cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-ehcache.xml (original)
+++ cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-ehcache.xml Thu Apr 5 06:33:39 2007
@@ -36,6 +36,7 @@
<property name="maxMemObjects" value="${org.apache.cocoon.store.maxobjects}"/>
<property name="useCacheDirectory" value="${org.apache.cocoon.store.use-cache-directory}"/>
<property name="settings" ref="org.apache.cocoon.configuration.Settings"/>
+ <property name="storeJanitor" ref="org.apache.excalibur.store.StoreJanitor"/>
</bean>
<!--
Modified: cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-transient.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-transient.xml?view=diff&rev=525824&r1=525823&r2=525824
==============================================================================
--- cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-transient.xml (original)
+++ cocoon/trunk/core/cocoon-store/cocoon-store-impl/src/main/resources/META-INF/cocoon/spring/cocoon-store-impl-transient.xml Thu Apr 5 06:33:39 2007
@@ -31,5 +31,6 @@
<bean name="org.apache.excalibur.store.Store/TransientStore" class="org.apache.cocoon.components.store.impl.DefaultTransientStore"
init-method="init" destroy-method="destroy">
<property name="maxObjects" value="${org.apache.cocoon.store.transient.maxobjects}"/>
+ <property name="storeJanitor" ref="org.apache.excalibur.store.StoreJanitor"/>
</bean>
</beans>