For Mozilla, '*.patch' apparently means 'text/html', so here's the same 
thing renamed to '*.patch.txt', just in case.

(: A ;)

Antti Koivunen wrote:
> This simple patch will considerably improve the performance in case 
> there are no cache listeners.
> 
> (: A ;)
> 
Index: AbstractCache.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/cache/AbstractCache.java,v
retrieving revision 1.6
diff -u -r1.6 AbstractCache.java
--- AbstractCache.java  17 Jan 2002 15:47:05 -0000      1.6
+++ AbstractCache.java  4 Mar 2002 15:24:28 -0000
@@ -11,8 +11,10 @@
 import java.util.Iterator;
 
 /**
+ * An abstract superclass for cache implementations.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]";>Eung-ju Park</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]";>Antti Koivunen</a>
  */
 public abstract class AbstractCache
     implements Cache
@@ -36,22 +38,30 @@
 
     protected void notifyAdded( final Object key, final Object value )
     {
-        final CacheEvent event = new CacheEvent( this, key, value );
+        CacheEvent event = null;
 
         final int s = m_listeners.size();
         for ( int i = 0; i < s; i++ )
         {
+            if ( event == null )
+            {
+                event = new CacheEvent( this, key, value );
+            }
             ((CacheListener)m_listeners.get( i )).added( event );
         }
     }
 
     protected void notifyRemoved( final Object key, final Object value )
     {
-        final CacheEvent event = new CacheEvent( this, key, value );
+        CacheEvent event = null;
 
         final int s = m_listeners.size();
         for ( int i = 0; i < s; i++ )
         {
+            if ( event == null )
+            {
+                event = new CacheEvent( this, key, value );
+            }
             ((CacheListener)m_listeners.get( i )).removed( event );
         }
     }

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to