User development, A new message was posted in the thread "AnnotatedElementMetaDataLoader component metadata optimization":
http://community.jboss.org/message/526747#526747 Author : Kabir Khan Profile : http://community.jboss.org/people/kabir.k...@jboss.com Message: -------------------------------------------------------------- Ok, I'll go with the singleton. The problems I was seeing with returning the singleton was that its getValidTime() method returned null, adding a validTime field makes all tests in mdr and kernel pass. I'll add a simple test for that and commit what I have so far against https://jira.jboss.org/jira/browse/JBMDR-66 So far we avoid creating AnnotatedElementLoaders and ScopeKeys for the cases where a member does not have any annotations. I think this could be taken a bit further, when a member has annotations, we currently create an AnnotatedElementLoader and thus a ScopeKey. As mentioned ScopeKeys are expensive to create due to creating their contained ConcurrentSkipListMap and this add call in the constructor which adds to the ConcurrentSkipListMap: public ScopeKey(Scope scope) { addScope(scope); } Since it looks like there will only be one scope level in the key created by AnnotatedElementLoader, I am going to play with changing private static final ScopeKey getScopeKey(AnnotatedElement annotated) { Scope scope; if (annotated instanceof Class) { Class<?> clazz = Class.class.cast(annotated); scope = new Scope(CommonLevels.CLASS, clazz); } else if (annotated instanceof Member) { Member member = (Member) annotated; scope = new Scope(CommonLevels.JOINPOINT, member); } else { return ScopeKey.DEFAULT_SCOPE; } return new ScopeKey(scope); } to private static final ScopeKey getScopeKey(AnnotatedElement annotated) { Scope scope; if (annotated instanceof Class) { Class<?> clazz = Class.class.cast(annotated); scope = new Scope(CommonLevels.CLASS, clazz); return new ScopeKey(scope); } else if (annotated instanceof Member) { Member member = (Member) annotated; scope = new Scope(CommonLevels.JOINPOINT, member); return new SingleLevelScopeKey(scope); } else { return ScopeKey.DEFAULT_SCOPE; } } where SingelLevelScopeKey will be a lightweight implementation of ScopeKey that does not have the internal ConcurrentSkipListMap. I might even be able to use the existing UnmodifiableScopeKey, so I will look into that first. I think this could this also be used for the CLASS scope? I need to check, but need to see if this could this also be used for the other metadata retrievals. -------------------------------------------------------------- To reply to this message visit the message page: http://community.jboss.org/message/526747#526747
_______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user