[jboss-cvs] JBossAS SVN: r78002 - in projects/aop/trunk: asintegration/src/main/org/jboss/aop/domain and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Sep 4 15:38:24 EDT 2008
Author: flavia.rainone at jboss.com
Date: 2008-09-04 15:38:24 -0400 (Thu, 04 Sep 2008)
New Revision: 78002
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/AspectManager.java
projects/aop/trunk/asintegration/src/main/org/jboss/aop/domain/ScopedRepositoryClassLoaderDomain.java
Log:
[JBAOP-630] I have implemented a new approach. Now AspectManager.getPerVMAspect is not synchronized, but has a
synchronized block on the AspectDesfinition. Inside this block, it doubles check to make sure there isn't an
instance of the per vm aspect.
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/AspectManager.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/AspectManager.java 2008-09-04 19:13:17 UTC (rev 78001)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/AspectManager.java 2008-09-04 19:38:24 UTC (rev 78002)
@@ -1899,7 +1899,7 @@
return getPerVMAspect(def.getName());
}
- public synchronized Object getPerVMAspect(String def)
+ public Object getPerVMAspect(String def)
{
Object aspect = perVMAspects.get(def);
if (aspect == null)
@@ -1909,7 +1909,12 @@
{
synchronized (adef)
{
- aspect = createPerVmAspect(def, adef, null);
+ // double check but, now, in a sync block
+ aspect = perVMAspects.get(def);
+ if (aspect == null)
+ {
+ aspect = createPerVmAspect(def, adef, null);
+ }
}
}
}
Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/domain/ScopedRepositoryClassLoaderDomain.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/domain/ScopedRepositoryClassLoaderDomain.java 2008-09-04 19:13:17 UTC (rev 78001)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/domain/ScopedRepositoryClassLoaderDomain.java 2008-09-04 19:38:24 UTC (rev 78002)
@@ -63,36 +63,39 @@
aspect = super.getSuperPerVmAspect(def);
if (aspect != null)
{
- LoaderRepository loadingRepository = getAspectRepository(aspect);
- LoaderRepository myRepository = getScopedRepository();
- if (loadingRepository == myRepository)
+ synchronized(myPerVMAspects)
{
- //The parent does not load this class
- myPerVMAspects.put(def, aspect);
- }
- else
- {
- //The class has been loaded by a parent classloader, find out if we also have a copy
- try
+ LoaderRepository loadingRepository = getAspectRepository(aspect);
+ LoaderRepository myRepository = getScopedRepository();
+ if (loadingRepository == myRepository)
{
- Class<?> clazz = myRepository.loadClass(aspect.getClass().getName());
- if (clazz == aspect.getClass())
+ //The parent does not load this class
+ myPerVMAspects.put(def, aspect);
+ }
+ else
+ {
+ //The class has been loaded by a parent classloader, find out if we also have a copy
+ try
{
- notMyPerVMAspects.put(def, Boolean.TRUE);
+ Class<?> clazz = myRepository.loadClass(aspect.getClass().getName());
+ if (clazz == aspect.getClass())
+ {
+ notMyPerVMAspects.put(def, Boolean.TRUE);
+ }
+ else
+ {
+ //We have a different version of the class deployed
+ AspectDefinition aspectDefinition = getAspectDefinition(def);
+ //Override the classloader to create the aspect instance
+ aspect = createPerVmAspect(def, aspectDefinition, getClassLoader());
+ myPerVMAspects.put(def, aspect);
+ }
}
- else
+ catch (ClassNotFoundException e)
{
- //We have a different version of the class deployed
- AspectDefinition aspectDefinition = getAspectDefinition(def);
- //Override the classloader to create the aspect instance
- aspect = createPerVmAspect(def, aspectDefinition, getClassLoader());
- myPerVMAspects.put(def, aspect);
+ throw new RuntimeException(e);
}
}
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException(e);
- }
}
}
More information about the jboss-cvs-commits
mailing list