[jboss-cvs] JBossAS SVN: r105187 - branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 24 17:29:07 EDT 2010
Author: flavia.rainone at jboss.com
Date: 2010-05-24 17:29:07 -0400 (Mon, 24 May 2010)
New Revision: 105187
Modified:
branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop/AspectAnnotationLoader.java
branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop/AspectXmlLoader.java
Log:
[JBAOP-793] Enable write locks during (un)deployment of aspects by AspectXmlLoader and AspectAnnotationLoader
Modified: branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop/AspectAnnotationLoader.java
===================================================================
--- branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop/AspectAnnotationLoader.java 2010-05-24 21:27:46 UTC (rev 105186)
+++ branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop/AspectAnnotationLoader.java 2010-05-24 21:29:07 UTC (rev 105187)
@@ -130,81 +130,97 @@
public void deployInputStreamIterator(Iterator it) throws Exception
{
- while (it.hasNext())
+ AspectManager.lock.lockWrite();
+ try
{
- InputStream stream = (InputStream) it.next();
- DataInputStream dstream = new DataInputStream(stream);
- ClassFile cf = null;
- try
+ while (it.hasNext())
{
- cf = new ClassFile(dstream);
- }
- finally
- {
- dstream.close();
- stream.close();
- }
- if (AspectManager.verbose) System.out.println("[debug] Looking for aspects in: " + cf.getName());
- AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
- if (visible != null)
- {
- AspectDefinition def = deployAspect(visible, cf);
-
- if (def == null)
+ InputStream stream = (InputStream) it.next();
+ DataInputStream dstream = new DataInputStream(stream);
+ ClassFile cf = null;
+ try
{
- def = deployInterceptor(visible, cf);
+ cf = new ClassFile(dstream);
}
-
- if (def == null)
+ finally
{
- deployDynamicCFlow(visible, cf);
+ dstream.close();
+ stream.close();
}
-
- if (def == null)
+ if (AspectManager.verbose) System.out.println("[debug] Looking for aspects in: " + cf.getName());
+ AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
+ if (visible != null)
{
- if (!deployPreparedClass(visible, cf))
+ AspectDefinition def = deployAspect(visible, cf);
+
+ if (def == null)
{
- deployPrecedence(visible, cf);
+ def = deployInterceptor(visible, cf);
}
+
+ if (def == null)
+ {
+ deployDynamicCFlow(visible, cf);
+ }
+
+ if (def == null)
+ {
+ if (!deployPreparedClass(visible, cf))
+ {
+ deployPrecedence(visible, cf);
+ }
+ }
}
}
}
+ finally
+ {
+ AspectManager.lock.unlockWrite();
+ }
}
public void undeployInputStreamIterator(Iterator it) throws Exception
{
- while (it.hasNext())
+ AspectManager.lock.lockWrite();
+ try
{
- InputStream stream = (InputStream) it.next();
- DataInputStream dstream = new DataInputStream(stream);
- ClassFile cf = null;
- try
+ while (it.hasNext())
{
- cf = new ClassFile(dstream);
+ InputStream stream = (InputStream) it.next();
+ DataInputStream dstream = new DataInputStream(stream);
+ ClassFile cf = null;
+ try
+ {
+ cf = new ClassFile(dstream);
+ }
+ finally
+ {
+ dstream.close();
+ stream.close();
+ }
+ if (AspectManager.verbose) System.out.println("[debug] Looking for aspects in: " + cf.getName());
+ AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
+ if (visible != null)
+ {
+ undeployAspect(visible, cf);
+ undeployInterceptor(visible, cf);
+ undeployDynamicCFlow(visible, cf);
+ undeployPreparedClass(visible, cf);
+ undeployPrecedence(visible, cf);
+ undeployPointcuts(cf);
+ undeployMixins(cf);
+ undeployIntroductions(cf);
+ undeployTypedefs(cf);
+ undeployCFlowStackDefs(cf);
+ undeployPrepares(cf);
+ undeployAnnotationIntroductions(cf);
+ }
}
- finally
- {
- dstream.close();
- stream.close();
- }
- if (AspectManager.verbose) System.out.println("[debug] Looking for aspects in: " + cf.getName());
- AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
- if (visible != null)
- {
- undeployAspect(visible, cf);
- undeployInterceptor(visible, cf);
- undeployDynamicCFlow(visible, cf);
- undeployPreparedClass(visible, cf);
- undeployPrecedence(visible, cf);
- undeployPointcuts(cf);
- undeployMixins(cf);
- undeployIntroductions(cf);
- undeployTypedefs(cf);
- undeployCFlowStackDefs(cf);
- undeployPrepares(cf);
- undeployAnnotationIntroductions(cf);
- }
}
+ finally
+ {
+ AspectManager.lock.unlockWrite();
+ }
}
private AspectDefinition deployAspect(AnnotationsAttribute visible, ClassFile cf) throws Exception
Modified: branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop/AspectXmlLoader.java
===================================================================
--- branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop/AspectXmlLoader.java 2010-05-24 21:27:46 UTC (rev 105186)
+++ branches/Branch_AOP_1_5/aop/src/main/org/jboss/aop/AspectXmlLoader.java 2010-05-24 21:29:07 UTC (rev 105187)
@@ -881,6 +881,7 @@
{
setupDefaultName(url);
Element top = doc.getDocumentElement();
+ AspectManager.lock.lockWrite();
try
{
deployTopElements(top);
@@ -891,6 +892,10 @@
if (AspectManager.verbose) e.printStackTrace();
throw new RuntimeException(e);
}
+ finally
+ {
+ AspectManager.lock.unlockWrite();
+ }
}
public void deployDomain(Element element) throws Exception
@@ -1087,13 +1092,21 @@
public void undeployXML(Document doc, URL url) throws Exception
{
- //Check for URL here
- setupDefaultName(url);
- undeployTopElements(doc.getDocumentElement());
+ AspectManager.lock.lockWrite();
+ try
+ {
+ //Check for URL here
+ setupDefaultName(url);
+ undeployTopElements(doc.getDocumentElement());
+
+ bulkUndeploy();
+ }
+ finally
+ {
+ AspectManager.lock.unlockWrite();
+ }
- bulkUndeploy();
-
}
private void bulkUndeploy()
More information about the jboss-cvs-commits
mailing list