1 Reply Latest reply on May 30, 2013 4:52 PM by Wolf-Dieter Fink

    Interceptor issue

    sri2 Newbie

      Hi,

       

      I created an interceptor extending from BasicCustomInterceptor implementing with MBean with simple methods.

      Initialized/Uninitiazed in start and stop overrided methods. It accesses these methods when creating and destroying bean.

      Somehow it has not accessed to visitDistributedExecuteCommand override method where my logic reside to compute something in distributed mode with numOwners=2. If I override other methods like visitPutKeyValueCommand then it accesses.

      To find the issue, I added some couple of methods by putting print out statement along return invokeNextInterceptor(ctx, command) Just for testing purpose. These methods are :

       

      1)//Not Accessed

      @Override

          public Object visitSizeCommand(InvocationContext ctx, SizeCommand command)  throws Throwable {

             

              System.out.println("Inside visitSizeCommand");

              return invokeNextInterceptor(ctx, command);       

          }

      2) //Not Accessed

      @Override

      public void visitCollection(InvocationContext ctx,  Collection<? extends VisitableCommand> toVisit) throws Throwable {

              System.out.println("Inside visitCollection");

      //        debug("Collection Size: " + toVisit.size() );

      }

       

      3) //Not Accessed

      @Override

      public  <V> Object visitDistributedExecuteCommand(InvocationContext ctx, DistributedExecuteCommand<V> command) throws Throwable {

              System.out.println("++++++++++++Inside visitDistributedExecuteCommand()");

              Object o = invokeNextInterceptor(ctx, command);

              // Some logic here

              return o;

          }

       

      4) // Accessed

      @Override

             public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand cmd) throws Throwable {

                System.out.println("Ignoring this call to enforce read-only behavior");

                return invokeNextInterceptor(ctx, cmd);

       

             }

       

      5) // Accessed

      @Override

             visitRemoveCommand(InvocationContext ctx, RemoveCommand cmd) throws Throwable {

                System.out.println("Visited::::visitRemoveCommand");

               return invokeNextInterceptor(ctx, cmd);

             }

       

      I'm using 5.3.0.Beta1 version with JDK 1.7.0_04. Interceptor added in config file. Testing with PiApproximationDemo and also with SimpleCache ( book, pay and list ) Infinispan book example.

       

      Please advice how do I make it access to visitDistributedExecuteCommand override method.

      And also advice how do I access to individual statistics from each node in distributed environment and show it on RHQ monitor/JConsole/JVisualVM by using MBeans or MXBeans.

      Do I have to write a plug in for RHQ? Or Do I have to write purely JMX code? I have to see each node info in addition to  these statistics from URL http://docs.jboss.org/infinispan/5.1/apidocs/jmxComponents.html#Statistics.

      Any input and code examples are appreciated. Thanks in Advance.

      Sri

       

      Partial Config file:

       

          <global>

                 <transport>        

                  <properties>            

                  <property name="configurationFile" value="jgroups.xml"/>

                  </properties>      

              </transport>

          </global> 

         <default>     

             <clustering mode="distribution">      

             <sync/>      

             <hash numOwners="2"/>   

            </clustering>

       

            <customInterceptors>

               <interceptor class="com.xxx.xxx.TestInterceptor" position="FIRST" />

            </customInterceptors>     

         </default>

       

      Output from SimpleCache Example:

       

      May 30, 2013 3:31:11 PM org.infinispan.remoting.transport.jgroups.JGroupsTransport start

      INFO: ISPN000078: Starting JGroups Channel

      May 30, 2013 3:31:11 PM org.jgroups.logging.JDKLogImpl warn

      WARNING: [JGRP00014] TP.discard_incompatible_packets has been deprecated: incompatible packets are discarded anyway

      May 30, 2013 3:31:11 PM org.jgroups.logging.JDKLogImpl warn

      WARNING: [JGRP00014] TP.enable_bundling has been deprecated: will be ignored as bundling is on by default

      May 30, 2013 3:31:11 PM org.jgroups.logging.JDKLogImpl warn

      WARNING: [JGRP00014] UNICAST.setTimeout has been deprecated: not used anymore

      May 30, 2013 3:31:14 PM org.infinispan.remoting.transport.jgroups.JGroupsTransport viewAccepted

      INFO: ISPN000094: Received new cluster view: [xxxx]

      May 30, 2013 3:31:14 PM org.infinispan.remoting.transport.jgroups.JGroupsTransport startJGroupsChannelIfNeeded

      INFO: ISPN000079: Cache local address is xxxx, physical addresses are [xxx]

      May 30, 2013 3:31:14 PM org.infinispan.factories.GlobalComponentRegistry start

      INFO: ISPN000128: Infinispan version: Infinispan 'Tactical Nuclear Penguin' 5.3.0.Beta1

      *************registering MBean: com.xxx.xxx:type=TestInterceptor

      ********* Printing Interceptors from interceptorChain

      ********* Interceptor name: com.xxx.xxx.TestInterceptor

      ********* Interceptor name: org.infinispan.interceptors.InvocationContextInterceptor

      ********* Interceptor name: org.infinispan.statetransfer.StateTransferInterceptor

      ********* Interceptor name: org.infinispan.statetransfer.TransactionSynchronizerInterceptor

      ********* Interceptor name: org.infinispan.interceptors.NotificationInterceptor

      ********* Interceptor name: org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor

      ********* Interceptor name: org.infinispan.interceptors.EntryWrappingInterceptor

      ********* Interceptor name: org.infinispan.interceptors.distribution.NonTxConcurrentDistributionInterceptor

      ********* Interceptor name: org.infinispan.interceptors.CallInterceptor

      May 30, 2013 3:31:14 PM org.infinispan.jmx.CacheJmxRegistration start

      INFO: ISPN000031: MBeans were successfully registered to the platform MBean server.

      Ticket booking system

      =====================

      Commands: book, pay, list

      > book

      Enter name aaa

      Enter show 111

      Visited::::visitPutKeyValueCommand

      Booked ticket Ticket{name='aaa', show='111'}

      > book

      Enter name bbb

      Enter show 222

      Visited::::visitPutKeyValueCommand

      Booked ticket Ticket{name='bbb', show='222'}

      > list

      Ticket{name='aaa', show='111'}

      Ticket{name='bbb', show='222'}

      > pay

      Enter ticketid 1

      Visited::::visitRemoveCommand

      Checked out ticket Ticket{name='aaa', show='111'}

      >