You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2008/01/24 17:12:35 UTC
[jira] Created: (JCR-1344) Unsynchronized NameFactoryImpl
initialization
Unsynchronized NameFactoryImpl initialization
---------------------------------------------
Key: JCR-1344
URL: https://issues.apache.org/jira/browse/JCR-1344
Project: Jackrabbit
Issue Type: Bug
Reporter: Thomas Mueller
Assignee: Thomas Mueller
Priority: Minor
org.apache.jackrabbit.spi.commons.name.NameFactoryImpl uses an unsafe pattern when initializing:
private static NameFactory FACTORY;
private NameFactoryImpl() {};
public static NameFactory getInstance() {
if (FACTORY == null) {
FACTORY = new NameFactoryImpl();
}
return FACTORY;
}
This is bad in a multi-threaded environment (see http://www.ibm.com/developerworks/library/j-dcl.html for details).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-1344) Unsynchronized NameFactoryImpl
initialization
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting updated JCR-1344:
-------------------------------
Component/s: jackrabbit-spi-commons
Fix Version/s: 1.5
Issue Type: Improvement (was: Bug)
It's not really harmful as there's no state in NameFactoryImpl, but I agree that the if statement there is not needed. Better to just initialize the FACTORY constant where it's declared.
> Unsynchronized NameFactoryImpl initialization
> ---------------------------------------------
>
> Key: JCR-1344
> URL: https://issues.apache.org/jira/browse/JCR-1344
> Project: Jackrabbit
> Issue Type: Improvement
> Components: jackrabbit-spi-commons
> Reporter: Thomas Mueller
> Assignee: Thomas Mueller
> Priority: Minor
> Fix For: 1.5
>
>
> org.apache.jackrabbit.spi.commons.name.NameFactoryImpl uses an unsafe pattern when initializing:
> private static NameFactory FACTORY;
> private NameFactoryImpl() {};
> public static NameFactory getInstance() {
> if (FACTORY == null) {
> FACTORY = new NameFactoryImpl();
> }
> return FACTORY;
> }
> This is bad in a multi-threaded environment (see http://www.ibm.com/developerworks/library/j-dcl.html for details).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (JCR-1344) Unsynchronized NameFactoryImpl
initialization
Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Mueller resolved JCR-1344.
---------------------------------
Resolution: Fixed
Committed in revision 614911
> Unsynchronized NameFactoryImpl initialization
> ---------------------------------------------
>
> Key: JCR-1344
> URL: https://issues.apache.org/jira/browse/JCR-1344
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-spi-commons
> Reporter: Thomas Mueller
> Assignee: Thomas Mueller
> Priority: Minor
>
> org.apache.jackrabbit.spi.commons.name.NameFactoryImpl uses an unsafe pattern when initializing:
> private static NameFactory FACTORY;
> private NameFactoryImpl() {};
> public static NameFactory getInstance() {
> if (FACTORY == null) {
> FACTORY = new NameFactoryImpl();
> }
> return FACTORY;
> }
> This is bad in a multi-threaded environment (see http://www.ibm.com/developerworks/library/j-dcl.html for details).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.