[ 
https://issues.apache.org/jira/browse/WICKET-2741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Fussenegger updated WICKET-2741:
---------------------------------------

    Attachment: wicket-2741.patch

this patch uses a copy-on-write approach to avoid synchronization for reads. 
Only in the rare event of a yet unmapped ClassLoader it's going to be a bit 
slower. While the patch seems to work very well a second or third pair of eyes 
would be very well appreciated. 

This patch also contains changes by patch for WICKET-2875 and reuses an empty 
array (new Field[0]) for classes without any injectable fields.

> non-performant Collections.synchronizedMap() should be replaced with 
> ConcurrentMap
> ----------------------------------------------------------------------------------
>
>                 Key: WICKET-2741
>                 URL: https://issues.apache.org/jira/browse/WICKET-2741
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.6
>            Reporter: Nikita Tovstoles
>         Attachments: wicket-2741.patch
>
>
> The following two classes use Collections.synchronizedMap() --> lots of 
> contention @ concurrent load. 
> * RequestListenerInterface.interfaces
> * WebApplication.addBufferedResponse
> * Injector.inject() - 'cache' field. 
> The last instance makes @SpringBean unusable in production (too much 
> contention @ concurrent load)
> Here's a sample output of contention around monitor of class 
> java.util.Collections$SynchronizedMap:
> {noformat}
> +--------------------------------------------------------------------------------------+------------------+-----------------+
> |                                         Name                                
>          |    Time (ms)     |      Count      |
> +--------------------------------------------------------------------------------------+------------------+-----------------+
> |  +---java.util.Collections$SynchronizedMap.get(Object)                      
>          |  126,101   51 %  |  19,145   52 %  |
> |  | |                                                                        
>          |                  |                 |
> |  | +---org.apache.wicket.injection.Injector.inject(Object, 
> IFieldValueFactory)       |  109,912   45 %  |  16,285   44 %  |
> |  | |                                                                        
>          |                  |                 |
> |  | +---org.springframework.beans.CachedIntrospectionResults.forClass(Class) 
>          |   16,188    7 %  |   2,860    8 %  |
> |  |                                                                          
>          |                  |                 |
> |  +---java.util.Collections$SynchronizedMap.put(Object, Object)              
>          |  119,343   49 %  |  17,676   48 %  |
> |    |                                                                        
>          |                  |                 |
> |    +---org.apache.wicket.injection.Injector.inject(Object, 
> IFieldValueFactory)       |                  |                 |
> |      |                                                                      
>          |                  |                 |
> |      +---org.apache.wicket.injection.ConfigurableInjector.inject(Object)    
>          |                  |                 |
> |        |                                                                    
>          |                  |                 |
> |        
> +---org.apache.wicket.injection.ComponentInjector.onInstantiation(Component)  
> |  118,060   48 %  |  17,467   47 %  |
> |        |                                                                    
>          |                  |                 |
> |        +---com.castanealabs.gui.model.ZipCodeValidator.<init>()             
>          |      686    0 %  |     106    0 %  |
> |        |                                                                    
>          |                  |                 |
> |        
> +---com.castanealabs.gui.model.ProductSkuProgramDataProvider.<init>(IModel)   
> |      337    0 %  |      59    0 %  |
> |        |                                                                    
>          |                  |                 |
> |        
> +---com.castanealabs.gui.model.ProductTypeProgramDataProvider.<init>(IModel)  
> |      259    0 %  |      44    0 %  |
> +--------------------------------------------------------------------------------------+------------------+-----------------+
> Generated by YourKit Java Profiler 8.0.22 Feb 12, 2010 3:52:25 PM
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to