You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by co...@apache.org on 2002/03/30 08:11:14 UTC

cvs commit: jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache AbstractCache.java

colus       02/03/29 23:11:14

  Modified:    cache/src/java/org/apache/avalon/excalibur/cache
                        AbstractCache.java
  Log:
  Move CacheEvent creation to outter of loop.
  
  Revision  Changes    Path
  1.10      +8 -8      jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache/AbstractCache.java
  
  Index: AbstractCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/cache/src/java/org/apache/avalon/excalibur/cache/AbstractCache.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractCache.java	27 Mar 2002 14:35:10 -0000	1.9
  +++ AbstractCache.java	30 Mar 2002 07:11:14 -0000	1.10
  @@ -40,12 +40,12 @@
           CacheEvent event = null;
   
           final int s = m_listeners.size();
  +        if( 0 < s )
  +        {
  +            event = new CacheEvent( this, key, value );
  +        }
           for( int i = 0; i < s; i++ )
           {
  -            if( event == null )
  -            {
  -                event = new CacheEvent( this, key, value );
  -            }
               ( (CacheListener)m_listeners.get( i ) ).added( event );
           }
       }
  @@ -55,12 +55,12 @@
           CacheEvent event = null;
   
           final int s = m_listeners.size();
  +        if( 0 < s )
  +        {
  +            event = new CacheEvent( this, key, value );
  +        }
           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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>