1 Reply Latest reply on Jun 5, 2012 6:30 AM by belaban

    Simple field write doesn't work ?

    belaban

      I have a simple class:

       

      {code}

      @Test(groups=Global.BYTEMAN,sequential=true)

      public class BytemanTest extends BMNGRunner {

       

          protected volatile boolean resending;

       

          @BMScript(dir="scripts/BytemanTest", value="testSample")

          public void testFoo() throws Exception {

              try {

                  resending=true;

              }

              finally {

                  resending=false;

              }

          }

      }

      {code}

       

      which sets field 'resending' to true in the try clause and to false in the finally clause. The associated rule is:

      {code}

      RULE SampleRule

      CLASS BytemanTest

      METHOD testFoo

      AFTER WRITE resending

      IF TRUE

         DO System.out.println("**** resending=" + $0.resending);

      ENDRULE

      {code}

       

      However, the rule is only triggered *once*: when resending is set to true. It is *not* triggered when resending is set to false, in the finally clause. The 'resending' field *is* indeed visible in the finally clause, so why isn't the rule triggered ?

       

      Cheers,

      Bela