Examples of CommandInterceptor


Examples of org.infinispan.interceptors.base.CommandInterceptor

    * Adds a new interceptor in list after an interceptor of a given type.
    *
    * @return true if the interceptor was added; i.e. the afterInterceptor exists
    */
   public boolean addInterceptorAfter(CommandInterceptor toAdd, Class<? extends CommandInterceptor> afterInterceptor) {
      CommandInterceptor it = firstInChain;
      while (it != null) {
         if (it.getClass().equals(afterInterceptor)) {
            toAdd.setNext(it.getNext());
            it.setNext(toAdd);
            return true;
         }
         it = it.getNext();
      }
      return false;
   }
View Full Code Here

Examples of org.infinispan.interceptors.base.CommandInterceptor

      if (firstInChain.getClass().equals(beforeInterceptor)) {
         toAdd.setNext(firstInChain);
         firstInChain = toAdd;
         return true;
      }
      CommandInterceptor it = firstInChain;
      while (it.getNext() != null) {
         if (it.getNext().getClass().equals(beforeInterceptor)) {
            toAdd.setNext(it.getNext());
            it.setNext(toAdd);
            return true;
         }
         it = it.getNext();
      }
      return false;
   }
View Full Code Here

Examples of org.infinispan.interceptors.base.CommandInterceptor

      if (firstInChain.getClass().equals(toBeReplacedInterceptorType)) {
         replacingInterceptor.setNext(firstInChain.getNext());
         firstInChain = replacingInterceptor;
         return true;
      }
      CommandInterceptor it = firstInChain;
      CommandInterceptor previous = firstInChain;
      while (it.getNext() != null) {
         CommandInterceptor current = it.getNext();
         if (current.getClass().equals(toBeReplacedInterceptorType)) {
            replacingInterceptor.setNext(current.getNext());
            previous.setNext(replacingInterceptor);
            return true;
         }
         previous = current;
         it = current;
View Full Code Here

Examples of org.jboss.cache.interceptors.base.CommandInterceptor

   public void setUp() throws Exception
   {
      cache = createCacheWithListener();
      mgr = cache.getTransactionManager();

      CommandInterceptor ici = TestingUtil.findInterceptor(cache, InvocationContextInterceptor.class);
      CommandInterceptor validateInterceptor = TestingUtil.findInterceptor(cache, OptimisticValidatorInterceptor.class);
      CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
      CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
      dummy = new MockInterceptor();
      ici.setNext(validateInterceptor);
      validateInterceptor.setNext(interceptor);
      interceptor.setNext(nodeInterceptor);
      nodeInterceptor.setNext(dummy);

      TestingUtil.replaceInterceptorChain(cache, ici);
      cache.addInterceptor(new ResetRemoteFlagInterceptor(), InvocationContextInterceptor.class);
   }
View Full Code Here

Examples of org.jboss.cache.interceptors.base.CommandInterceptor

   @BeforeMethod
   public void setUp() throws Exception
   {
      cache = createCache();

      CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
      CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
      dummy = new MockInterceptor();

      interceptor.setNext(nodeInterceptor);
      nodeInterceptor.setNext(dummy);

      TestingUtil.replaceInterceptorChain(cache, interceptor);

      mgr = cache.getTransactionManager();
   }
View Full Code Here

Examples of org.jboss.cache.interceptors.base.CommandInterceptor

      listener = new TestListener();
      cache = createCacheWithListener(listener);

      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);

      CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
      cr.registerComponent(interceptor, OptimisticCreateIfNotExistsInterceptor.class);
      CommandInterceptor nodeInterceptor = new OptimisticNodeInterceptor();
      cr.registerComponent(nodeInterceptor, OptimisticNodeInterceptor.class);
      dummy = new MockInterceptor();
      cr.registerComponent(dummy, MockInterceptor.class);

      interceptor.setNext(nodeInterceptor);
      nodeInterceptor.setNext(dummy);

      TestingUtil.replaceInterceptorChain(cache, interceptor);

      mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
   }
View Full Code Here

Examples of org.jboss.cache.interceptors.base.CommandInterceptor

   @BeforeMethod
   public void setUp() throws Exception
   {
      cache = createCache();

      CommandInterceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
      CommandInterceptor nodeInterceptor = TestingUtil.findInterceptor(cache, OptimisticNodeInterceptor.class);
      dummy = new MockInterceptor();

      interceptor.setNext(nodeInterceptor);
      nodeInterceptor.setNext(dummy);

      TestingUtil.replaceInterceptorChain(cache, interceptor);

      mgr = cache.getTransactionManager();
   }
View Full Code Here

Examples of org.jboss.cache.interceptors.base.CommandInterceptor

      final int minSleep = 0;
      final int maxSleep = 1000;
      TestListener listener = new TestListener();
      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);

      CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
      CommandInterceptor dummy = new MockInterceptor();
      interceptor.setNext(dummy);

      TestingUtil.replaceInterceptorChain(cache, interceptor);

      // should just be the root node
View Full Code Here

Examples of org.jboss.cache.interceptors.base.CommandInterceptor

      final int minSleep = 0;
      final int maxSleep = 500;
      TestListener listener = new TestListener();
      final CacheSPI<Object, Object> cache = createCacheWithListener(listener);

      CommandInterceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
      CommandInterceptor dummy = new MockInterceptor();
      interceptor.setNext(dummy);

      TestingUtil.replaceInterceptorChain(cache, interceptor);

      final DummyTransactionManager mgr = DummyTransactionManager.getInstance();
View Full Code Here

Examples of org.jboss.cache.interceptors.base.CommandInterceptor

         before = getAttributeValue(interceptorElement, "before");
         if (!existsAttribute(before)) before = null;
         after = getAttributeValue(interceptorElement, "after");
         if (!existsAttribute(after)) after = null;

         CommandInterceptor interceptor = buildCommandInterceptor(interceptorElement);

         CustomInterceptorConfig customInterceptorConfig = new CustomInterceptorConfig(interceptor, first, last, index, after, before);
         interceptorConfigs.add(customInterceptorConfig);
      }
      return interceptorConfigs;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.