This content has been marked as final.
Show 7 replies
-
1. Re: Metamodel and collections
wolfc Nov 15, 2007 4:33 AM (in response to anil.saldhana)java.lang.NullPointerException at org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData.getPrincipalVersusRolesMap(JBossAssemblyDescriptorMetaData.java:360) at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:159)
Code with an explicit check on null is twice as fast. So I would save 1ms for every ~100000 calls. :-)
Seriously: the code in getPrincipalVersusRolesMap is too slow for per EJB call usage. I would rather see the reversed mapping being dynamically maintained in SecurityRolesMetaData. -
2. Re: Metamodel and collections
adrian.brock Nov 15, 2007 5:55 AM (in response to anil.saldhana)"wolfc" wrote:
Code with an explicit check on null is twice as fast. So I would save 1ms for every ~100000 calls. :-)
More importantly referencing an empty collection uses more memory and slows down
garbage collection.
If only the new for() loop checked for null and didn't iterate instead of throwing an NPE. ;-) -
3. Re: Metamodel and collections
wolfc Nov 15, 2007 6:06 AM (in response to anil.saldhana)I'll fix the lot.
-
4. Re: Metamodel and collections
anil.saldhana Nov 15, 2007 10:00 AM (in response to anil.saldhana)"adrian@jboss.org" wrote:
"wolfc" wrote:
Code with an explicit check on null is twice as fast. So I would save 1ms for every ~100000 calls. :-)
If only the new for() loop checked for null and didn't iterate instead of throwing an NPE. ;-)
Yes, the enhanced for loop should have been checking for nulls. -
5. Re: Metamodel and collections
anil.saldhana Nov 15, 2007 11:52 AM (in response to anil.saldhana)"wolfc" wrote:
java.lang.NullPointerException at org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData.getPrincipalVersusRolesMap(JBossAssemblyDescriptorMetaData.java:360) at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:159)
Code with an explicit check on null is twice as fast. So I would save 1ms for every ~100000 calls. :-)
Seriously: the code in getPrincipalVersusRolesMap is too slow for per EJB call usage. I would rather see the reversed mapping being dynamically maintained in SecurityRolesMetaData.
You are right. That map needs to be generated one time during deployment and accessed multiple times. I see that you made the changes. Is this what you did? -
-
7. Re: Metamodel and collections
wolfc Nov 16, 2007 5:29 AM (in response to anil.saldhana)Deeper into the empty collections we can have silly mergers:
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas?view=rev&revision=67166
Somewhere the empty collection should not have been created in the first place.