[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Re: AOPConstructorJoinpoint and methodHasSubInstanceMetaData

adrian@jboss.org do-not-reply at jboss.com
Thu Jul 24 07:38:56 EDT 2008


Ok, but that has nothing to do with ConfigureAction
(that's just where we found the problem).

The same problem could occur anywhere where it creates collections.
e.g. passing it as a parameter to create()

The problem is that when it is creating say an EJB3CacheRegistry
and as part of one of the callbacks (in this case setting a Map property)
it has to construct invoke AbstractTypeMetaData.createInstance().

NOTE: I don't see any other places where a ConstructorJoinPoint is invoked.

So this goes through the AOPConstructorJoinpoint which expects
there to be a MetaDataStack entry for the Map.

But this Map is not under the direct control of the MC, it has no context
or MDR MetaData.

So the fix is probably two parts.
Can you try this, to see whether it works? There might be
some issues I'm not aware of with passing null on the MetaDataStack to 
AOPConstructorJoinPoint?

1) AbstractTypeMetaData needs to mask the EJB3CacheRegistry's
MetaData context when it uses the constructor joinpoint to create the Map.


  | MetaDataStack.mask();
  | try
  | {
  |       Object result = constructor.dispatch();
  | }
  | finally
  | {
  |    MetaDataStack.unmask();
  | }
  | 

2) AOPConstructorJoinpoint needs to have code that says if the
MetaDataStack is empty then just invoke parent.dispatch()
rather than doing the proxy factory stuff.


  |    public Object dispatch() throws Throwable
  |    {
  |       Class<?> clazz = constructorInfo.getDeclaringClass().getType();
  |       MetaData metaData = MetaDataStack.peek();
  |        if (metaData == null)
  |           return super.dispatch();
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4166387#4166387

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4166387



More information about the jboss-dev-forums mailing list