-
Bug
-
Resolution: Done
-
Major
-
EAP 5.0.0
-
None
During a JNDI lookup test, it looks to me that in org.jboss.metadata.web.jboss.JBossWebMetaData there is a useless synchronization by runAsIdentity (marked by >>) since runAsIdentity is not touched by neither of the lines besides .put() method call.
If the synchronization is only wrapping put() call, double calls to put() wont harm the behaviour (if roleName stays the same) but wont cause thread contention when runAs is null. It is responsible for roughly 9% of all thread contention (see attached graphs and data). Example patch attached.
The proper synchronization should have also covered the initial runAsIdentity.get(servletName) so that there arent 2 threads heading into the put section but it is not performance-friendly.
/**
- Access the RunAsIdentity associated with the given servlet
- @param servletName - the servlet-name from the web.xml
- @return RunAsIdentity for the servet if one exists, null otherwise
*/
@XmlTransient
public RunAsIdentityMetaData getRunAsIdentity(String servletName)
{
RunAsIdentityMetaData identity = runAsIdentity.get(servletName);
if (identity == null)
{
JBossServletsMetaData servlets = getServlets();
if(servlets != null)
{
ServletMetaData servlet = servlets.get(servletName);
if (servlet != null)
{
// Check for a web.xml run-as only specification
>> synchronized (runAsIdentity)Unknown macro: { RunAsMetaData runAs = servlet.getRunAs(); if (runAs != null) { String roleName = runAs.getRoleName(); identity = new RunAsIdentityMetaData(roleName, null); runAsIdentity.put(servletName, identity); } }}
}
}
return identity;
}
- relates to
-
JBPAPP-4795 Upgrade JBoss Metadata to 1.0.6 on EAP 5.1
- Closed