1 Reply Latest reply on Sep 23, 2016 6:08 AM by adinn

    Bytemap keeps on giving error invalid local variable binding

    gaurav6281

      My Java method is :-

       

      private static Object workingProducer() throws InterruptedException {

        String producerThreadName = Thread.currentThread().getName();

        System.out.println("Producer Thread..." + producerThreadName);

        String testMsg="Hello world";

         int messageCount = 0;

         while (true) {

         blockingQueue.put(messageCount++);

        System.out.println("Thread " + producerThreadName + " inserting " + messageCount + " into the blocking Queue");

         // sleep for 1 seconds so that we can see in console how threads are working
         Thread.sleep(1000);

        }

      }

       

      My .btm file is :-

       

      RULE run producer then halt but consumers continue to run

      CLASS ThreadInteraction

      METHOD workingProducer

      AFTER WRITE $producerThreadName

      BIND testingMessage = $testMsg;

      IF true

      DO traceln($testMsg)

      ENDRULE

       

      When I run this on debug (-Dorg.jboss.byteman.verbose) , it shows me

       

      RuleCheckMethodAdapter.checkBindings : invalid local variable binding $testMsg checking method workingProducer()Ljava/lang/Object;

       

      But you can see testMsg variable name exists in above private java method.

       

      What is wrong in the usage?  Please provide me the right usage is anything is wrong.