1 Reply Latest reply on Sep 17, 2018 4:47 AM by adinn

    How to create and access the counters?

    dmbhat

      Hello, I have tried below way of creating and accessing the counters. But, observing the error:

      threw org.jboss.byteman.rule.exception.ParseException: rule try-counter-1

      k_try_count.btm line 8 : invalid expression

       

      Following is the rule:

      RULE try-counter-1

      CLASS com.my.pckg.Helper

      METHOD execute(int, int)

      AT ENTRY

      IF TRUE

      DO

        createCounter($0)

         incrementCounter($0)

      ENDRULE

       

      Tried the following way of creating rule as well:

      RULE try-counter-1

      CLASS com.my.pckg.Helper

      METHOD execute(int, int)

      AT ENTRY

      IF TRUE

      DO

        createCounter("execute counter")

         incrementCounter("execute counter")

      ENDRULE

       

      Confused on how to use the counters. Please help me with examples.

        • 1. Re: How to create and access the counters?
          adinn

          Hi Dinesh,

           

          dmbhat  wrote:

           

          Hello, I have tried below way of creating and accessing the counters. But, observing the error:

          threw org.jboss.byteman.rule.exception.ParseException: rule try-counter-1

          k_try_count.btm line 8 : invalid expression

           

          Following is the rule:

          RULE try-counter-1

          CLASS com.my.pckg.Helper

          METHOD execute(int, int)

          AT ENTRY

          IF TRUE

          DO

            createCounter($0)

             incrementCounter($0)

          ENDRULE

           

          Tried the following way of creating rule as well:

          RULE try-counter-1

          CLASS com.my.pckg.Helper

          METHOD execute(int, int)

          AT ENTRY

          IF TRUE

          DO

            createCounter("execute counter")

             incrementCounter("execute counter")

          ENDRULE

           

          Confused on how to use the counters. Please help me with examples.

           

          The problem is a syntax error at line 8 i.e. between the calls to builtin methods createCounter($0) on line 7 and incrementCounter($0) on line 8. You need to insert a statement separator ';' between the two calls. Try this:

           

          RULE try-counter-1
          CLASS com.my.pckg.Helper
          METHOD execute(int, int)
          AT ENTRY
          IF TRUE
          DO
            createCounter($0);
            incrementCounter($0)
          ENDRULE

           

          regards,

           

           

          Andrew Dinn