[jboss-user] [JBoss Seam] - Let's use component scope before lookupInStatefulContexts
dmitriy.lapko
do-not-reply at jboss.com
Thu Oct 25 13:27:21 EDT 2007
One of the key methods of Seam in class Component is:
| public static Object getInstance(String name, boolean create)
| {
| Object result = Contexts.lookupInStatefulContexts(name);
| result = getInstance(name, create, result);
| return result;
| }
|
Method lookupInStatefulContexts checks all possible scopes for an instance of a requested component. But as for me, usually a scope for a component is defined and I don't understand, why can't we use this information before scanning of all contexts.
If I marked my component by annotation @Scope, and defined its scope to Session, wouldn't it be faster not to check method, event, page and conversation scopes before getting it from session? Searching in method, event and page contexts is fast, just hashmap searching, but for conversation scope it is much longer and depends on component realization.
Why do I ask - because in my application there are more session scoped components then conversation scoped. And for them method ServerConversationContext.isPerNestedConversation is called anyway and it takes more then 1% of CPU time in all application, because it iterates among all methods in component trying to find annotation PerNestedConversation (I profiled it with JProfiler).
So, it just a question for discussion - what is a key reason not to use
Component component = Component.forName(name);
| component.getScope();
in method Contexts.lookupInStatefulContexts and search only in this scope or untill this scope?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4098938#4098938
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098938
More information about the jboss-user
mailing list