[jboss-jira] [JBoss JIRA] Created: (JBRULES-1085) Rule fires before calling fireAllRules

Markus Reitz (JIRA) jira-events at lists.jboss.org
Wed Aug 15 14:34:01 EDT 2007


Rule fires before calling fireAllRules
--------------------------------------

                 Key: JBRULES-1085
                 URL: http://jira.jboss.com/jira/browse/JBRULES-1085
             Project: JBoss Rules
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions:  4.0.0.GA
            Reporter: Markus Reitz
         Assigned To: Mark Proctor


Modifying the main method of the program fragment used in ( http://jira.jboss.com/jira/browse/JBRULES-1079 ) to

  public static void main(String ... args) {
    try {
      DroolsTest test=new DroolsTest(new File(args[0]));
      
      SpecialString first42 =new SpecialString("42");
      SpecialString second42=new SpecialString("42");
      
      System.out.println("Inserting ...");
      
      test.getSession().insert(new SpecialString("World"));
      test.getSession().insert(first42);
      test.getSession().insert(second42);

      System.out.println("Done.");
      
      System.out.println("Firing rules ...");
      
      test.getSession().fireAllRules();
      
      System.out.println("Done.");
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }

and using the rule

  package test

  rule "Strange rule"

    when
      not(exists(x : SpecialString() and
                 forall(y : SpecialString(this!=x)
                            SpecialString(this==y, text=="Universe"))))

    then
      System.out.println("Condition satisfied");
  end

leads to the following output:

  Condition satisfied
  Inserting ...
  Done.
  Firing rules ...
  Condition satisfied
  Done.

The Drools Engine fires the rule before the method fireAllRules() is called in the main method. As a result, 

      System.out.println("Condition satisfied");

is executed twice.

-- 
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