directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r371295 - /directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java
Date Sun, 22 Jan 2006 14:02:36 GMT
Author: trustin
Date: Sun Jan 22 06:02:33 2006
New Revision: 371295

URL: http://svn.apache.org/viewcvs?rev=371295&view=rev
Log:
Improved the performance of BaseIoSession.getAttribute()

Modified:
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java?rev=371295&r1=371294&r2=371295&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/support/BaseIoSession.java
Sun Jan 22 06:02:33 2006
@@ -165,6 +165,17 @@
 
     public Object getAttribute( String key )
     {
+        Object value;
+        synchronized( attributes )
+        {
+            value = attributes.get( key );
+        }
+        
+        if( value != null )
+        {
+            return value;
+        }
+        
         for( int i = attributeOverriders.length - 1; i >= 0; i -- )
         {
             IoSessionAttributeOverrider overrider = attributeOverriders[ i ];
@@ -185,10 +196,7 @@
             }
         }
 
-        synchronized( attributes )
-        {
-            return attributes.get( key );
-        }
+        return null;
     }
 
     public Object setAttribute( String key, Object value )



Mime
View raw message