[jboss-jira] [JBoss JIRA] (DROOLS-578) add double null check to asm stub builders

david hendi (JIRA) issues at jboss.org
Mon Aug 25 21:27:59 EDT 2014


david hendi created DROOLS-578:
----------------------------------

             Summary: add double null check to asm stub builders
                 Key: DROOLS-578
                 URL: https://issues.jboss.org/browse/DROOLS-578
             Project: Drools
          Issue Type: Patch
      Security Level: Public (Everyone can see)
    Affects Versions: 6.1.0.Final, 6.1.0.CR2, 6.1.0.CR1, 6.1.0.Beta4, 6.1.0.Beta3, 6.1.0.Beta2, 6.1.0.Beta1
            Reporter: david hendi
            Assignee: Mark Proctor


currently the code generated does a null check within the synchronized code. this forces all threads to block while the check is made even after the check returns false. by adding a double null check, the synchronized code is bypassed once the check is satisfied. 

public void evaluate(KnowledgeHelper paramKnowledgeHelper, WorkingMemory paramWorkingMemory)
            throws Exception
    {
        if (this.consequence == null) {
            synchronized (this) {
                if (this.consequence == null) {
                    ConsequenceGenerator.generate(this, paramKnowledgeHelper, paramWorkingMemory);
                }
            }
        }
        this.consequence.evaluate(paramKnowledgeHelper, paramWorkingMemory);
    }



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the jboss-jira mailing list