longstone created SYNCOPE-1448:
----------------------------------

             Summary: Bean loading/register section not threadsafe
                 Key: SYNCOPE-1448
                 URL: https://issues.apache.org/jira/browse/SYNCOPE-1448
             Project: Syncope
          Issue Type: Bug
          Components: core
            Reporter: longstone


Issue:

When two threads (T1,T2) arrive the section {{if 
(ApplicationContextProvider.getBeanFactory().containsSingleton(ruleClass.getName()))
 {}}at the same time they will both assume that there is no bean, which is 
right so far.

T1 register the bean as it should here 
{{ApplicationContextProvider.getBeanFactory().registerSingleton(ruleClass.getName(),
 rule);}}. As soon as T2does the same, an exception is thrown.

Solution:

When T1 and T2 found that a given bean is not there, they'll hit a synchronized 
section with double checking. This will prevent the duplicated creation and 
registration of a bean.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to