/** * When a CachedResponse is removed from the Cache, any entries 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) { Iterator it = coll.iterator(); while (it.hasNext()) { /* remove all entries in the event-indexed map where this * PCK key is the value. */ Object o = it.next(); if (o != null) { if (getLogger().isDebugEnabled()) { getLogger().debug("Removing from event mapping: " + o.toString()); } m_eventMMap.remove(o, key); } } // remove all entries in the key-indexed map where this PCK key // is the key -- confused yet? m_keyMMap.remove(key); } }
/** 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"); } return null; } else { return (Serializable[]) coll.toArray(new Serializable[coll.size()]); } }