[jboss-jira] [JBoss JIRA] Commented: (JGRP-643) ClassConfigurator.getInstance() not thread safe
Michael Newcomb (JIRA)
jira-events at lists.jboss.org
Mon Dec 10 09:06:51 EST 2007
[ http://jira.jboss.com/jira/browse/JGRP-643?page=comments#action_12391326 ]
Michael Newcomb commented on JGRP-643:
--------------------------------------
ClassConfigurator.getInstance(true) is called indirectly from the JChannel constructor. If you create 2 or more JChannels in seperate threads this method can be called in an unsafe manner.
This does indeed occur because I got a "magic key x (...) is already in map..." exception which indicates 2 init calls got through. Interestingly enough, it occurs only on my dual core computer ;).
Could you make the creation and assignment of 'instance' a class-level static initializer block? That way there would be no need for synchronization and no chance of multiple calls?
> ClassConfigurator.getInstance() not thread safe
> -----------------------------------------------
>
> Key: JGRP-643
> URL: http://jira.jboss.com/jira/browse/JGRP-643
> Project: JGroups
> Issue Type: Bug
> Reporter: Michael Newcomb
> Assigned To: Bela Ban
> Priority: Minor
> Fix For: 2.7
>
>
> Creating 2 or more JChannels simultaneously could result in multiple ClassConfigurators being created and inited at once or a ClassConfigurator being used before it has been inited.
> Recommend synchronizing the getInstance() method.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list