Examples of CommandInterceptor


Examples of org.infinispan.interceptors.base.CommandInterceptor

      if (cfg.getInterceptor() != null) return cfg.getInterceptor().getClass();
      return Util.loadClass(cfg.getClassName(), configuration.getClassLoader());
   }

   private CommandInterceptor getOrCreateCustomInterceptor(CustomInterceptorConfig cfg) {
      CommandInterceptor result = cfg.getInterceptor();
      if (result == null) {
         result = Util.getInstance(cfg.getClassName(), configuration.getClassLoader());
      }
      register(result.getClass(), result);
      return result;
   }
View Full Code Here

Examples of org.infinispan.interceptors.base.CommandInterceptor

         interceptor.setNext(firstInChain);
         firstInChain = interceptor;
         return;
      }
      if (firstInChain == null) return;
      CommandInterceptor it = firstInChain;
      int index = 0;
      while (it != null) {
         if (++index == position) {
            interceptor.setNext(it.getNext());
            it.setNext(interceptor);
            return;
         }
         it = it.getNext();
      }
      throw new IllegalArgumentException("Invalid index: " + index + " !");
   }
View Full Code Here

Examples of org.infinispan.interceptors.base.CommandInterceptor

      if (firstInChain == null) return;
      if (position == 0) {
         firstInChain = firstInChain.getNext();
         return;
      }
      CommandInterceptor it = firstInChain;
      int index = 0;
      while (it != null) {
         if (++index == position) {
            if (it.getNext() == null) return; //nothing to remove
            it.setNext(it.getNext().getNext());
            return;
         }
         it = it.getNext();
      }
      throw new IllegalArgumentException("Invalid position: " + position + " !");
   }
View Full Code Here

Examples of org.infinispan.interceptors.base.CommandInterceptor

   /**
    * Returns the number of interceptors in the chain.
    */
   public int size() {
      int size = 0;
      CommandInterceptor it = firstInChain;
      while (it != null) {
         size++;
         it = it.getNext();
      }
      return size;

   }
View Full Code Here

Examples of org.infinispan.interceptors.base.CommandInterceptor

    */
   public List<CommandInterceptor> asList() {
      if (firstInChain == null) return Collections.emptyList();

      List<CommandInterceptor> retval = new LinkedList<CommandInterceptor>();
      CommandInterceptor tmp = firstInChain;
      do {
         retval.add(tmp);
         tmp = tmp.getNext();
      }
      while (tmp != null);
      return Collections.unmodifiableList(retval);
   }
View Full Code Here

Examples of org.infinispan.interceptors.base.CommandInterceptor

    */
   public void removeInterceptor(Class<? extends CommandInterceptor> clazz) {
      if (firstInChain.getClass() == clazz) {
         firstInChain = firstInChain.getNext();
      }
      CommandInterceptor it = firstInChain.getNext();
      CommandInterceptor prevIt = firstInChain;
      while (it != null) {
         if (it.getClass() == clazz) {
            prevIt.setNext(it.getNext());
         }
         prevIt = it;
         it = it.getNext();
      }
   }
View Full Code Here

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.infinispan.interceptors.base.CommandInterceptor

   /**
    * Appends at the end.
    */
   public synchronized void appendIntereceptor(CommandInterceptor ci) {
      CommandInterceptor it = firstInChain;
      while (it.hasNext()) it = it.getNext();
      it.setNext(ci);
      // make sure we nullify the "next" pointer in the last interceptors.
      ci.setNext(null);
   }
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.