You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by as...@apache.org on 2008/06/02 15:51:32 UTC
svn commit: r662435 - in /cocoon/branches/BRANCH_2_1_X: ./
src/blocks/eventcache/java/org/apache/cocoon/caching/impl/
src/blocks/eventcache/java/org/apache/cocoon/samples/
src/java/org/apache/cocoon/components/store/impl/
Author: asavory
Date: Mon Jun 2 06:51:32 2008
New Revision: 662435
URL: http://svn.apache.org/viewvc?rev=662435&view=rev
Log:
COCOON-2152 apply fix from Ellis Pritchard; make samples work again
Modified:
cocoon/branches/BRANCH_2_1_X/blocks.properties
cocoon/branches/BRANCH_2_1_X/gump.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/AbstractDoubleMapEventRegistry.java
cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java
cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventRegistryDataWrapper.java
cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java
cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/samples/EventAwareGenerator.java
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
cocoon/branches/BRANCH_2_1_X/status.xml
Modified: cocoon/branches/BRANCH_2_1_X/blocks.properties
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/blocks.properties?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/blocks.properties (original)
+++ cocoon/branches/BRANCH_2_1_X/blocks.properties Mon Jun 2 06:51:32 2008
@@ -167,7 +167,7 @@
#-----[dependency]: "cron" is needed by "jms", "portal".
#include.block.cron=false
#include.block.deli=false
-#-----[dependency]: "eventcache" depends on "jms".
+#-----[dependency]: "eventcache" depends on "jms", "template" (for samples).
#-----[dependency]: "eventcache" is needed by "repository", "webdav".
#include.block.eventcache=false
#-----[dependency]: "faces" depends on "portal", "taglib".
@@ -199,7 +199,7 @@
#include.block.stx=false
#-----[dependency]: "taglib" is needed by "faces".
#include.block.taglib=false
-#-----[dependency]: "template" is needed by "ajax", "captcha", "forms".
+#-----[dependency]: "template" is needed by "ajax", "captcha", "eventcache", "forms".
#include.block.template=false
#-----[dependency]: "tour" depends on "batik", "fop", "forms", "slop".
#include.block.tour=false
Modified: cocoon/branches/BRANCH_2_1_X/gump.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/gump.xml?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/gump.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/gump.xml Mon Jun 2 06:51:32 2008
@@ -1201,6 +1201,7 @@
<depend project="cocoon" inherit="all"/>
<depend project="cocoon-block-jms"/>
+ <depend project="cocoon-block-template" type="samples"/>
<depend project="jms"/>
<work nested="build/cocoon-@@DATE@@/blocks/eventcache/dest"/>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/AbstractDoubleMapEventRegistry.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/AbstractDoubleMapEventRegistry.java?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/AbstractDoubleMapEventRegistry.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/AbstractDoubleMapEventRegistry.java Mon Jun 2 06:51:32 2008
@@ -18,7 +18,10 @@
import java.io.Serializable;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
import org.apache.avalon.framework.activity.Disposable;
@@ -27,7 +30,7 @@
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.caching.EventRegistry;
import org.apache.cocoon.caching.validity.Event;
-import org.apache.commons.collections.MultiHashMap;
+import org.apache.commons.collections.map.MultiValueMap;
/**
* This abstract base implementation of <code>EventRegistry</code> stores
@@ -41,8 +44,7 @@
* simplicity favors inheritance.
*
* @since 2.1
- * @author <a href="mailto:ghoward@apache.org">Geoff Howard</a>
- * @version CVS $Id$
+ * @version $Id$
*/
public abstract class AbstractDoubleMapEventRegistry
@@ -50,9 +52,14 @@
implements Initializable, EventRegistry, Disposable, ThreadSafe {
private boolean m_init_success = false;
- private MultiHashMap m_keyMMap;
- private MultiHashMap m_eventMMap;
-
+ // maps to store keys and events: always accessed through MultiValue decorators
+ private Map m_keyMap;
+ private Map m_eventMap;
+
+ // maps which decorate the maps above to give the MultiMap behavior
+ private MultiValueMap m_keyMultiMap;
+ private MultiValueMap m_eventMultiMap;
+
/**
* Registers (stores) a two-way mapping between this Event and this
* PipelineCacheKey for later retrieval.
@@ -62,8 +69,8 @@
*/
public void register(Event e, Serializable key) {
synchronized(this) {
- m_keyMMap.put(key,e);
- m_eventMMap.put(e,key);
+ m_keyMultiMap.put(key,e);
+ m_eventMultiMap.put(e,key);
}
}
@@ -72,8 +79,8 @@
*/
public void clear() {
synchronized(this) {
- m_keyMMap.clear();
- m_eventMMap.clear();
+ m_keyMultiMap.clear();
+ m_eventMultiMap.clear();
}
}
@@ -81,14 +88,16 @@
* Retrieve all pipeline keys mapped to this event.
*/
public Serializable[] keysForEvent(Event e) {
- Collection coll = (Collection)m_eventMMap.get(e);
- if (coll==null || coll.isEmpty()) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("The event map returned empty");
+ synchronized(this) {
+ Collection coll = (Collection)m_eventMultiMap.get(e);
+ if (coll==null || coll.isEmpty()) {
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("The event map returned empty");
+ }
+ return null;
+ } else {
+ return (Serializable[])coll.toArray(new Serializable[coll.size()]);
}
- return null;
- } else {
- return (Serializable[])coll.toArray(new Serializable[coll.size()]);
}
}
@@ -96,9 +105,11 @@
* Return all pipeline keys mapped to any event
*/
public Serializable[] allKeys() {
- Set keys = this.m_keyMMap.keySet();
- return (Serializable[])keys.toArray(
- new Serializable[keys.size()]);
+ synchronized(this) {
+ Set keys = this.m_keyMultiMap.keySet();
+ return (Serializable[])keys.toArray(
+ new Serializable[keys.size()]);
+ }
}
/**
@@ -106,13 +117,13 @@
* in the event mapping must be cleaned up.
*/
public void removeKey(Serializable key) {
- Collection coll = (Collection)m_keyMMap.get(key);
- if (coll==null || coll.isEmpty()) {
- return;
- }
- // get the iterator over all matching PCK keyed
- // entries in the key-indexed MMap.
synchronized(this) {
+ Collection coll = (Collection)m_keyMultiMap.get(key);
+ if (coll==null) {
+ return;
+ }
+ // get the iterator over all matching PCK keyed
+ // entries in the key-indexed MMap.
Iterator it = coll.iterator();
while (it.hasNext()) {
/* remove all entries in the event-indexed map where this
@@ -123,13 +134,13 @@
if (getLogger().isDebugEnabled()) {
getLogger().debug("Removing from event mapping: " + o.toString());
}
- m_eventMMap.remove(o,key);
+ m_eventMultiMap.remove(o,key);
}
}
// remove all entries in the key-indexed map where this PCK key
// is the key -- confused yet?
- m_keyMMap.remove(key);
+ m_keyMultiMap.remove(key);
}
}
@@ -150,10 +161,10 @@
public void dispose() {
EventRegistryDataWrapper ecdw = wrapRegistry();
persist(ecdw);
- m_keyMMap.clear();
- m_keyMMap = null;
- m_eventMMap.clear();
- m_eventMMap = null;
+ m_keyMultiMap = null;
+ m_eventMultiMap = null;
+ m_keyMap = null;
+ m_eventMap = null;
}
/**
@@ -165,18 +176,26 @@
protected EventRegistryDataWrapper wrapRegistry() {
EventRegistryDataWrapper ecdw = new EventRegistryDataWrapper();
- ecdw.setupMaps(this.m_keyMMap, this.m_eventMMap);
+ ecdw.setupMaps(this.m_keyMap, this.m_eventMap);
return ecdw;
}
protected void unwrapRegistry(EventRegistryDataWrapper ecdw) {
- this.m_eventMMap = ecdw.get_eventMap();
- this.m_keyMMap = ecdw.get_keyMap();
+ this.m_eventMap = ecdw.get_eventMap();
+ this.m_keyMap = ecdw.get_keyMap();
+ createMultiMaps();
}
protected final void createBlankCache() {
- this.m_eventMMap = new MultiHashMap();
- this.m_keyMMap = new MultiHashMap();
+ // TODO: don't hardcode initial size
+ this.m_eventMap = new HashMap(1000);
+ this.m_keyMap = new HashMap(1000);
+ createMultiMaps();
+ }
+
+ protected void createMultiMaps() {
+ this.m_eventMultiMap = MultiValueMap.decorate(m_eventMap,HashSet.class);
+ this.m_keyMultiMap = MultiValueMap.decorate(m_keyMap,HashSet.class);
}
/**
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java Mon Jun 2 06:51:32 2008
@@ -18,8 +18,13 @@
import java.io.Serializable;
import java.util.Iterator;
+import java.util.Timer;
+import java.util.TimerTask;
import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.activity.Startable;
+import org.apache.avalon.framework.parameters.ParameterException;
+import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.cocoon.ProcessingException;
@@ -34,72 +39,83 @@
/**
* This implementation holds all mappings between Events and PipelineCacheKeys
- * in two MultiHashMap to facilitate efficient lookup by either as Key.
+ * in two MultiValueMaps to facilitate efficient lookup by either as Key.
*
- * @author Geoff Howard (ghoward@apache.org)
* @version $Id$
*/
-public class EventAwareCacheImpl extends CacheImpl implements Initializable,
- EventAware {
-
+public class EventAwareCacheImpl
+ extends CacheImpl
+ implements Initializable, Startable, EventAware {
+
private ServiceManager m_manager;
- private EventRegistry m_eventRegistry;
+ private EventRegistry m_eventRegistry;
+
+ // clean-up thread
+ private static final Timer timer = new Timer("event-cache-checker",true);
+ private TimerTask timerTask;
+ private long interval;
+
+ public void parameterize(Parameters parameters) throws ParameterException {
+
+ super.parameterize(parameters);
+ this.interval = parameters.getParameterAsInteger("cleanupthreadinterval",1000*60*60); // 1 hour
+ if(this.interval < 1) {
+ throw new ParameterException("EventAwareCacheImpl cleanupthreadinterval parameter has to be greater then 1");
+ }
+
+ String eventRegistryName = parameters.getParameter("registry", EventRegistry.ROLE);
+ try {
+ this.m_eventRegistry = (EventRegistry)m_manager.lookup(eventRegistryName);
+ } catch (ServiceException e) {
+ throw new ParameterException("Unable to lookup registry: " + eventRegistryName, e);
+ }
+ }
- /**
+ /**
* Clears the entire Cache, including all registered event-pipeline key
* mappings..
- */
- public void clear() {
- super.clear();
+ */
+ public void clear() {
+ super.clear();
m_eventRegistry.clear();
- }
+ }
- /**
- * When a new Pipeline key is stored, it needs to be have its
+ /**
+ * When a new Pipeline key is stored, it needs to have it's
* <code>SourceValidity</code> objects examined. For every
- * <code>EventValidity</code> found, its <code>Event</code> will be
+ * <code>EventValidity</code> found, it's <code>Event</code> will be
* registered with this key in the <code>EventRegistry</code>.
*
* <code>AggregatedValidity</code> is handled recursively.
- */
- public void store(Serializable key,
- CachedResponse response)
- throws ProcessingException {
+ */
+ public void store(Serializable key,
+ CachedResponse response)
+ throws ProcessingException {
SourceValidity[] validities = response.getValidityObjects();
for (int i=0; i< validities.length;i++) {
SourceValidity val = validities[i];
examineValidity(val, key);
}
super.store(key, response);
- }
-
- /* (non-Javadoc)
- * @see org.apache.cocoon.caching.Cache#store(java.io.Serializable, org.apache.cocoon.caching.CachedResponse)
-
- public void store(Serializable key, CachedResponse response)
- throws ProcessingException {
- // TODO Auto-generated method stub
- super.store(key, response);
- }*/
+ }
/**
* Look up the EventRegistry
*/
- public void service(ServiceManager manager) throws ServiceException {
- this.m_manager = manager;
+ public void service(ServiceManager manager) throws ServiceException {
+ this.m_manager = manager;
super.service(manager);
- this.m_eventRegistry = (EventRegistry)manager.lookup(EventRegistry.ROLE);
- }
+ }
- /**
+ /**
* Un-register this key in the EventRegistry in addition to
* removing it from the Store
- */
- public void remove(Serializable key) {
- super.remove(key);
+ */
+ public void remove(Serializable key) {
+ super.remove(key);
m_eventRegistry.removeKey(key);
- }
+ }
/**
* Receive notification about the occurrence of an Event.
@@ -130,14 +146,14 @@
* Get the EventRegistry ready, and make sure it does not contain
* orphaned Event/PipelineKey mappings.
*/
- public void initialize() throws Exception {
- if (!m_eventRegistry.wasRecoverySuccessful()) {
+ public void initialize() throws Exception {
+ if (!m_eventRegistry.wasRecoverySuccessful()) {
super.clear();
} else {
// Not sure if we want this overhead here, but where else?
- veryifyEventCache();
+ verifyEventCache();
}
- }
+ }
/**
* Ensure that all PipelineCacheKeys registered to events still
@@ -147,7 +163,7 @@
* stray events could hang around indefinitely if the cache is
* removed abnormally or is not configured with persistence.
*/
- public void veryifyEventCache() {
+ public void verifyEventCache() {
Serializable[] keys = m_eventRegistry.allKeys();
if (keys == null) return;
for (int i=0; i<keys.length; i++) {
@@ -164,12 +180,12 @@
/**
* Release resources
*/
- public void dispose() {
+ public void dispose() {
m_manager.release(m_eventRegistry);
- super.dispose();
+ super.dispose();
m_manager = null;
m_eventRegistry = null;
- }
+ }
private void examineValidity(SourceValidity val, Serializable key) {
if (val instanceof AbstractAggregatedValidity) {
@@ -199,5 +215,20 @@
}
m_eventRegistry.register(val.getEvent(),key);
}
+
+ /**
+ * starts cache-cleaner timer task scheduling
+ */
+ public void start() throws Exception {
+ getLogger().debug("Intializing event-cache checker thread");
+ timerTask = new TimerTask() { public void run() {verifyEventCache();}; };
+ timer.schedule(timerTask, interval, interval);
+ }
+ /**
+ * stops cache-cleaner timer task scheduling
+ */
+ public void stop() {
+ timerTask.cancel();
+ }
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventRegistryDataWrapper.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventRegistryDataWrapper.java?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventRegistryDataWrapper.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventRegistryDataWrapper.java Mon Jun 2 06:51:32 2008
@@ -17,35 +17,36 @@
package org.apache.cocoon.caching.impl;
import java.io.Serializable;
-
-import org.apache.commons.collections.MultiHashMap;
+import java.util.Map;
/**
* A light object for persisting the state of an EventRegistry implementation
* based on two MultiHashMaps.
*
- * @author <a href="mailto:ghoward@apache.org">Geoff Howard</a>
- * @version CVS $Id$
+ * @version $Id$
*/
public class EventRegistryDataWrapper implements Serializable {
- private MultiHashMap m_keyMMap;
- private MultiHashMap m_eventMMap;
+ private static final long serialVersionUID = -419774862702021018L;
+ private Map m_keyMap;
+ private Map m_eventMap;
public EventRegistryDataWrapper() {
+ this.m_keyMap = null;
+ this.m_eventMap = null;
}
- public void setupMaps(MultiHashMap keyMap, MultiHashMap eventMap) {
- this.m_keyMMap = keyMap;
- this.m_eventMMap = eventMap;
+ public void setupMaps(Map keyMap, Map eventMap) {
+ this.m_keyMap = keyMap;
+ this.m_eventMap = eventMap;
}
- public MultiHashMap get_eventMap() {
- return m_eventMMap;
+ public Map get_eventMap() {
+ return m_eventMap;
}
- public MultiHashMap get_keyMap() {
- return m_keyMMap;
+ public Map get_keyMap() {
+ return m_keyMap;
}
}
\ No newline at end of file
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/StoreEventRegistryImpl.java Mon Jun 2 06:51:32 2008
@@ -18,6 +18,9 @@
import java.io.IOException;
+import org.apache.avalon.framework.parameters.ParameterException;
+import org.apache.avalon.framework.parameters.Parameterizable;
+import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
@@ -32,12 +35,21 @@
* @version CVS $Id$
*/
public class StoreEventRegistryImpl extends AbstractDoubleMapEventRegistry
- implements Serviceable {
+ implements Serviceable, Parameterizable {
private static final String EVENTREGISTRYKEY = "EVENTREGWRAPPER";
private ServiceManager m_manager;
private Store m_store;
+ public void parameterize(Parameters parameters) throws ParameterException {
+ String storeName = parameters.getParameter("store",Store.ROLE);
+ try {
+ this.m_store = (Store) m_manager.lookup(storeName);
+ } catch (ServiceException e) {
+ throw new ParameterException("Unable to lookup store: " + storeName, e);
+ }
+ }
+
protected void persist(EventRegistryDataWrapper wrapper) {
EventRegistryDataWrapper ecdw = wrapRegistry();
try {
@@ -55,23 +67,28 @@
*/
public void service(ServiceManager manager) throws ServiceException {
this.m_manager = manager;
- this.m_store = (Store) manager.lookup(Store.ROLE);
}
/**
* Recover the datawrapper from the Store.
*/
protected boolean recover() {
- Object o = m_store.get(EVENTREGISTRYKEY);
- m_store.remove(EVENTREGISTRYKEY);
- if (o != null && o instanceof EventRegistryDataWrapper) {
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Retrieving EventRegistry from Store.");
+ try {
+ Object o = m_store.get(EVENTREGISTRYKEY);
+ m_store.remove(EVENTREGISTRYKEY);
+ if (o != null && o instanceof EventRegistryDataWrapper) {
+ if (getLogger().isInfoEnabled()) {
+ getLogger().info("Retrieving EventRegistry from Store.");
+ }
+ unwrapRegistry((EventRegistryDataWrapper) o);
+ return true;
+ } else {
+ getLogger().warn("Unable to recover Event Registry.");
+ super.createBlankCache();
+ return false;
}
- unwrapRegistry((EventRegistryDataWrapper) o);
- return true;
- } else {
- getLogger().warn("Unable to recover Event Registry.");
+ } catch(Exception e) {
+ getLogger().warn("Unable to recover Event Registry.",e);
super.createBlankCache();
return false;
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/samples/EventAwareGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/samples/EventAwareGenerator.java?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/samples/EventAwareGenerator.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/samples/EventAwareGenerator.java Mon Jun 2 06:51:32 2008
@@ -24,7 +24,7 @@
import org.apache.cocoon.caching.validity.NamedEvent;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.generation.JXTemplateGenerator;
+import org.apache.cocoon.template.JXTemplateGenerator;
import org.apache.excalibur.source.SourceValidity;
import org.xml.sax.SAXException;
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java Mon Jun 2 06:51:32 2008
@@ -420,12 +420,7 @@
* @see org.apache.excalibur.store.Store#containsKey(java.lang.Object)
*/
public boolean containsKey(Object key) {
- try {
- return this.cache.get((Serializable) key) != null;
- } catch (CacheException e) {
- getLogger().error("Failure retrieving object from store",e);
- }
- return false;
+ return this.cache.isKeyInCache((Serializable) key);
}
/* (non-Javadoc)
Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=662435&r1=662434&r2=662435&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Mon Jun 2 06:51:32 2008
@@ -182,6 +182,9 @@
<changes>
<release version="2.1.12" date="TBD">
+ <action dev="AS" type="fix" fixes-bug="COCOON-2152" due-to="Ellis Pritchard" due-to-email="epritcha@wiley.com">
+ Eventcache: Events are persisted and restored and sample works
+ </action>
<action dev="AN" type="update">
POI Block: Update to poi-3.0.2.
</action>
Re: svn commit: r662435 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/eventcache/java/org/apache/cocoon/caching/impl/ src/blocks/eventcache/java/org/apache/cocoon/samples/ src/java/org/apache/cocoon/components/store/impl/
Posted by Andrew Savory <me...@andrewsavory.com>.
Hi,
2008/6/6 Antonio Gallardo <ag...@agssa.net>:
> I am glad to see you back! Please see below:
Thanks ;-)
> The above constructor is since java 1.5. Would you change the code to run
> with java 1.4? Many thanks in advance. :)
>
Ooops ... my bad. Working on it now ...
Andrew.
--
asavory@apache.org / contact@andrewsavory.com
http://www.andrewsavory.com/
Re: svn commit: r662435 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/eventcache/java/org/apache/cocoon/caching/impl/
src/blocks/eventcache/java/org/apache/cocoon/samples/ src/java/org/apache/cocoon/components/store/impl/
Posted by Antonio Gallardo <ag...@agssa.net>.
Hi Andrew,
I am glad to see you back! Please see below:
asavory@apache.org escribió:
> Author: asavory
> Date: Mon Jun 2 06:51:32 2008
> New Revision: 662435
>
> URL: http://svn.apache.org/viewvc?rev=662435&view=rev
> Log:
> COCOON-2152 apply fix from Ellis Pritchard; make samples work again
>
>
>
> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java
> URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java?rev=662435&r1=662434&r2=662435&view=diff
> ==============================================================================
> --- cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java (original)
> +++ cocoon/branches/BRANCH_2_1_X/src/blocks/eventcache/java/org/apache/cocoon/caching/impl/EventAwareCacheImpl.java Mon Jun 2 06:51:32 2008
> @@ -34,72 +39,83 @@
>
> /**
> * This implementation holds all mappings between Events and PipelineCacheKeys
> - * in two MultiHashMap to facilitate efficient lookup by either as Key.
> + * in two MultiValueMaps to facilitate efficient lookup by either as Key.
> *
> - * @author Geoff Howard (ghoward@apache.org)
> * @version $Id$
> */
> -public class EventAwareCacheImpl extends CacheImpl implements Initializable,
> - EventAware {
> -
> +public class EventAwareCacheImpl
> + extends CacheImpl
> + implements Initializable, Startable, EventAware {
> +
> private ServiceManager m_manager;
>
> - private EventRegistry m_eventRegistry;
> + private EventRegistry m_eventRegistry;
> +
> + // clean-up thread
> + private static final Timer timer = new Timer("event-cache-checker",true);
>
The above constructor is since java 1.5. Would you change the code to
run with java 1.4? Many thanks in advance. :)
Best Regards,
Antonio Gallardo.