[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3485) Optimize how the InitialContext is created in org.jboss.seam.util.Naming

Jay Balunas (JIRA) jira-events at lists.jboss.org
Wed Oct 1 09:59:20 EDT 2008


Optimize how the InitialContext is created in org.jboss.seam.util.Naming
------------------------------------------------------------------------

                 Key: JBSEAM-3485
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3485
             Project: Seam
          Issue Type: Task
          Components: Core
    Affects Versions: 2.1.0.BETA1
            Reporter: Jay Balunas
             Fix For: 2.1.1.CR1
         Attachments: patch.txt

Seam currently only creates and manages the InitialContext in the "org.jboss.seam.util.Naming" class (see: http://fisheye.jboss.org/browse/Seam/trunk/src/main/org/jboss/seam/util/Naming.java?r=5444 ).   The properties are set in one location and done only once during the initialization of seam (see: http://fisheye.jboss.org/browse/Seam/trunk/src/main/org/jboss/seam/init/Initialization.java?r=9116#l915 ).

I see two issues here although they are related.  

The first issue would require some caching mechanism or logic for reuse of the InitialContext instance instead of recreating it every time.  WE need to determine when it makes sense to reuse an instance of the InitialContext, and when we need to get it fresh.  We currently use they exact same properties to initialize it and those are set during Seam initialization and do not appear to ever change once created.  

The second issue is that we do a certain amount of processing every time the context is requested, this could be optimized.  Currently I see a few blocked threads on the "props.size()" call in the Naming class which is a synchronized method on the Hashtable.  We need to maintain the logic that if the property list is empty we continue to call "new InitialContext()" and not pass in the properties object.  This is because the first thing the InitialContext constructor does with a properties object is clone it which can be costly.  This change is not as important if we find a way to cache the initial context.  I have attached a patch that implements these changes.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list