Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-6496

Custom interceptor's start method not called if interceptor added via AdvancedCache

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 8.1.2.Final
    • Core
    • None

      Suppose I want to add trivial custom interceptor like this:

      public class LocalIndexInterceptor extends BaseCustomInterceptor {
          @Override
          protected void start() {
              System.out.println("Start method executed");
          }
        // override some command methods here   
      }
      

      When I attach the interceptor via:

      cache.getAdvancedCache().addInterceptor(new LocalIndexInterceptor(), 0);
      

      the start method never gets called and nothing is printed. When I add the interceptor during the cache configuration (via ConfigurationBuilder.customInterceptor().addInterceptor().interceptor()), everything works fine and the start method is executed.

      I noticed at the @Start annotation Javadoc: "Method level annotation that indicates a (no-param) method to be called on a component registered in the ComponentRegistry when the cache starts.", so I get it that it's not executed since the cache is already started. However, without the start() method being executed, I cannot access cache additional object (DistributionManager, RpcManager) in the interceptor, which might be needed (and I needed it ).

              Unassigned Unassigned
              jholusa Jiří Holuša (Inactive)
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: