[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Improving the process of applying AnnotationPlugins on M

jaikiran do-not-reply at jboss.com
Sun Apr 5 08:12:24 EDT 2009


Ales,

I haven't yet given this a try, will do it some time tonight. But as i mentioned earlier, i think this won't solve our issue completely :) Here's what i mean:

- As can be seen in the attached MCAnnotationPlugin_BEFORE screenshot, in the JIRA, its the call to MetaDataRetrievalToMetaDataBridge.getComponentMetaData that would have to be minimized
- Right now, its being called for every single method/field in the object hierarchy.
- Consider this case:

public class FirstPOJO
  | {
  | 
  |  private Integer fieldOne;
  | 
  |  private Integer fieldTwo;
  | 
  |  ... totally 20 such fields, which are of no meaning to MC
  | 
  |  // One single field which is relevant to MC (annotation plugin) 
  |  @Inject
  |  private SomeMCBean tobeInjected;
  | 
  |  ... 20 getter/setter
  | }
  | 
  | 


public class SecondPOJO extends FirstPOJO
  | {
  | 
  |   private Integer doNotBotherMC;
  |   .. such 20 more fields and getter/setters
  | 
  |   // the only method, which is relevant to MC (annotation plugin) 
  |   @Inject
  |   public void setSomeBean(SimplePOJO mcbean)
  |   {
  |    ....
  |   }
  |  
  | 
  | }
  | 
  | 

In this example, we just have a one level hierarchy of the MC pojos. In this hiearchy, there just 1 field and 1 method which MC (ideally) needs to process for annotation plugins. The rest 40 odd methods and fields in this hierarchy are of no relevance to the MC. 

However, the way it currently behaves, MC first creates the ComponentMetaData for each of these 40 odd fields and methods, then checks for any relevant MC annotations and if not found (correctly) ignores those members. 

Now, assuming that we introduced the @MCAnnotations annotation. In that case, the POJOs will have this:

@MCAnnotations (Inject.class)
  | public class FirstPOJO
  | {
  |  ...// rest code remains the same
  | 


@MCAnnotations (Inject.class)
  | public class SecondPOJO extends FirstPOJO
  | {
  |  ...// rest code remains the same
  | 
  | 
This still won't solve our original issue, because on finding the @MCAnnotations (Inject.class), MC is still going to create the ComponentMetaData for all those 40 fields/method (out of which only a couple are relevant for MC).

I guess, we either have to reduce the number of calls to getComponentMetaData() or tune the getComponentMetaData() itself. 


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

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



More information about the jboss-dev-forums mailing list