Package org.jboss.cache.interceptors

Examples of org.jboss.cache.interceptors.Interceptor


   public void testConcurrentPut() throws Exception
   {
      final String slowThreadName = "SLOW";
      final String fastThreadName = "FAST";
      Interceptor slowdownInterceptor = new Interceptor()
      {
         public Object invoke(InvocationContext ctx) throws Throwable
         {
            if (Thread.currentThread().getName().equals(slowThreadName))
            {
View Full Code Here


   public void testConcurrentRemove() throws Exception
   {
      final String slowThreadName = "SLOW";
      final String fastThreadName = "FAST";
      Interceptor slowdownInterceptor = new Interceptor()
      {
         public Object invoke(InvocationContext ctx) throws Throwable
         {
            if (Thread.currentThread().getName().equals(slowThreadName) && ctx.getMethodCall().getMethodId() == MethodDeclarations.optimisticPrepareMethod_id)
            {
View Full Code Here

   public void setUp() throws Exception
   {
      listener = new TestListener();
      cache = createCacheWithListener(listener);

      Interceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
      Interceptor 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

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

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

      TestingUtil.replaceInterceptorChain(cache, interceptor);

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

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

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

      TestingUtil.replaceInterceptorChain(cache, interceptor);

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

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

      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache);

      Interceptor interceptor = new OptimisticCreateIfNotExistsInterceptor();
      cr.registerComponent(interceptor, OptimisticCreateIfNotExistsInterceptor.class);
      Interceptor 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

   public void setUp() throws Exception
   {
      listener = new TestListener();
      cache = createCacheWithListener(listener);

      Interceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
      Interceptor 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

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

      Interceptor ici = TestingUtil.findInterceptor(cache, InvocationContextInterceptor.class);
      Interceptor validateInterceptor = TestingUtil.findInterceptor(cache, OptimisticValidatorInterceptor.class);
      Interceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
      Interceptor 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);

      System.out.println("Interceptors: " + CachePrinter.printCacheInterceptors(cache));
View Full Code Here

   public void setUp() throws Exception
   {
      listener = new TestListener();
      cache = createCacheWithListener(listener);

      Interceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
      Interceptor 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

   public void setUp() throws Exception
   {
      listener = new TestListener();
      cache = createCacheWithListener(listener);

      Interceptor interceptor = TestingUtil.findInterceptor(cache, OptimisticCreateIfNotExistsInterceptor.class);
      Interceptor 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

TOP

Related Classes of org.jboss.cache.interceptors.Interceptor

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.