Package org.infinispan.interceptors

Examples of org.infinispan.interceptors.InterceptorChain


         }
         return invokeNextInterceptor(ctx, command);
      }

      public static TxCommandInterceptor inject(Cache cache) {
         InterceptorChain chain = TestingUtil.extractComponent(cache, InterceptorChain.class);
         if (chain.containsInterceptorType(TxCommandInterceptor.class)) {
            return (TxCommandInterceptor) chain.getInterceptorsWithClass(TxCommandInterceptor.class).get(0);
         }
         TxCommandInterceptor interceptor = new TxCommandInterceptor();
         chain.addInterceptorBefore(interceptor, CallInterceptor.class);
         return interceptor;
      }
View Full Code Here


      do {
         cr.wireDependencies(i);
      }
      while ((i = i.getNext()) != null);

      InterceptorChain inch = cr.getComponent(InterceptorChain.class);
      inch.setFirstInChain(interceptor);
   }
View Full Code Here

      CommandInterceptor i = replacingInterceptor;
      do {
         cr.wireDependencies(i);
      }
      while ((i = i.getNext()) != null);
      InterceptorChain inch = cr.getComponent(InterceptorChain.class);
      return inch.replaceInterceptor(replacingInterceptor, toBeReplacedInterceptorType);
   }
View Full Code Here

      // Execute the prepare on both nodes
      LocalTransaction localTx = txTable.getLocalTransaction(tm(c1).getTransaction());
      txCoordinator.prepare(localTx);

      // Delay the commit on the remote node. Can't used blockNewTransactions because we don't want a StateTransferInProgressException
      InterceptorChain c2ic = TestingUtil.extractComponent(c2, InterceptorChain.class);
      c2ic.addInterceptorBefore(new CommandInterceptor() {
         @Override
         protected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable {
            if (command instanceof CommitCommand) {
               Thread.sleep(3000);
            }
View Full Code Here

      volatile Runnable beforeEvict;
      volatile Runnable afterEvict;

      public AfterPassivationOrCacheWriter injectThis(Cache<Object, Object> injectInCache) {
         InterceptorChain chain = TestingUtil.extractComponent(injectInCache, InterceptorChain.class);
         List<CommandInterceptor> list = chain.getInterceptorsWhichExtend(CacheWriterInterceptor.class);
         if (list.isEmpty()) {
            list = chain.getInterceptorsWhichExtend(CacheLoaderInterceptor.class);
         }
         if (list.isEmpty()) {
            throw new IllegalStateException("Should not happen!");
         }
         injectInCache.getAdvancedCache().addInterceptorAfter(this, list.get(0).getClass());
View Full Code Here

      CommandsFactory commandsFactory = mock(CommandsFactory.class);
      PersistenceManager persistenceManager = mock(PersistenceManager.class);
      DataContainer dataContainer = mock(DataContainer.class);
      TransactionTable transactionTable = mock(TransactionTable.class);
      StateTransferLock stateTransferLock = mock(StateTransferLock.class);
      InterceptorChain interceptorChain = mock(InterceptorChain.class);
      InvocationContextFactory icf = mock(InvocationContextFactory.class);
      TotalOrderManager totalOrderManager = mock(TotalOrderManager.class);
      BlockingTaskAwareExecutorService remoteCommandsExecutor = mock(BlockingTaskAwareExecutorService.class);
      L1Manager l1Manager = mock(L1Manager.class);
View Full Code Here

   }

   private class AfterActivationOrCacheLoader extends ControlledCommandInterceptor {

      public AfterActivationOrCacheLoader injectThis(Cache<Object, Object> injectInCache) {
         InterceptorChain chain = TestingUtil.extractComponent(injectInCache, InterceptorChain.class);
         if (chain.containsInterceptorType(CacheLoaderInterceptor.class)) {
            injectInCache.getAdvancedCache().addInterceptorAfter(this, CacheLoaderInterceptor.class);
         } else if (chain.containsInterceptorType(ClusteredCacheLoaderInterceptor.class)) {
            injectInCache.getAdvancedCache().addInterceptorAfter(this, ClusteredCacheLoaderInterceptor.class);
         } else if (chain.containsInterceptorType(ActivationInterceptor.class)) {
            injectInCache.getAdvancedCache().addInterceptorAfter(this, ActivationInterceptor.class);
         } else if (chain.containsInterceptorType(ClusteredActivationInterceptor.class)) {
            injectInCache.getAdvancedCache().addInterceptorAfter(this, ClusteredActivationInterceptor.class);
         } else {
            throw new IllegalStateException("Should not happen!");
         }
         return this;
View Full Code Here

      private StreamingMarshaller marshaller(Ownership ownership) {
         return cacheEnumMap.get(ownership).getAdvancedCache().getComponentRegistry().getCacheMarshaller();
      }

      private long loads(Ownership ownership) {
         InterceptorChain chain = extractComponent(cache(ownership), InterceptorChain.class);
         CacheLoaderInterceptor interceptor = (CacheLoaderInterceptor) chain.getInterceptorsWhichExtend(CacheLoaderInterceptor.class).get(0);
         return interceptor.getCacheLoaderLoads();
      }
View Full Code Here

         CacheLoaderInterceptor interceptor = (CacheLoaderInterceptor) chain.getInterceptorsWhichExtend(CacheLoaderInterceptor.class).get(0);
         return interceptor.getCacheLoaderLoads();
      }

      private void resetStats(Ownership ownership) {
         InterceptorChain chain = extractComponent(cache(ownership), InterceptorChain.class);
         CacheLoaderInterceptor interceptor = (CacheLoaderInterceptor) chain.getInterceptorsWhichExtend(CacheLoaderInterceptor.class).get(0);
         interceptor.resetStatistics();
      }
View Full Code Here

         }
         return invokeNextInterceptor(ctx, command);
      }

      public static CountingInterceptor inject(Cache cache) {
         InterceptorChain chain = TestingUtil.extractComponent(cache, InterceptorChain.class);
         if (chain.containsInterceptorType(CountingInterceptor.class)) {
            return (CountingInterceptor) chain.getInterceptorsWithClass(CountingInterceptor.class).get(0);
         }
         CountingInterceptor interceptor = new CountingInterceptor();
         chain.addInterceptorBefore(interceptor, CallInterceptor.class);
         return interceptor;
      }
View Full Code Here

TOP

Related Classes of org.infinispan.interceptors.InterceptorChain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.