XFireFactory singleton code not correct
---------------------------------------

                 Key: XFIRE-756
                 URL: http://jira.codehaus.org/browse/XFIRE-756
             Project: XFire
          Issue Type: Bug
    Affects Versions: 1.2.2
         Environment: n/a
            Reporter: Matthew
         Assigned To: Dan Diephouse
            Priority: Minor


The newInstance method can still produce multiple factories.

  public static XFireFactory newInstance()
    {
        if (standalone == null)
        {
            synchronized (XFireFactory.class)
            {
                if (defaultFacClass != null)
                {
                    standalone = loadFactory(defaultFacClass);
                }
                else
                {
                    standalone = new XFireFactory();
                }
            }
        }
        return standalone;
    }

You should use the double check pattern and check for standalone being null 
again inside the synchronize block.  
Same problem in both newInstance methods.  

Why is the method called *new*Instance when it really returns an old existing 
instance???


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

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to