Examples of BaseCustomInterceptor


Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

   public void testKeyOnlyWrittenOnceOnOriginator() throws Exception {
      final Cache<MagicKey, String> cache1 = cache(0, CACHE_NAME);
      final Cache<MagicKey, String> cache2 = cache(1, CACHE_NAME);

      final CyclicBarrier barrier = new CyclicBarrier(2);
      cache1.getAdvancedCache().addInterceptor(new BaseCustomInterceptor() {
         @Override
         public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable {
            if (!ctx.isOriginLocal()) {
               // wait first before the check
               barrier.await(10, TimeUnit.SECONDS);
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

   }

   private CheckPoint injectBlockingCommandInterceptor(String cacheName) {
      AdvancedCache<?, ?> advancedCache = cache(cacheName).getAdvancedCache();
      final CheckPoint checkPoint = new CheckPoint();
      advancedCache.addInterceptorBefore(new BaseCustomInterceptor() {

         private final AtomicBoolean first = new AtomicBoolean(false);

         @Override
         public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable {
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

         cacheManager.defineConfiguration("correct-cache-1", cacheManager.getDefaultCacheConfiguration());
         cacheManager.defineConfiguration("correct-cache-2", cacheManager.getDefaultCacheConfiguration());
         cacheManager.defineConfiguration("correct-cache-3", cacheManager.getDefaultCacheConfiguration());
         ConfigurationBuilder incorrectBuilder = new ConfigurationBuilder();
         incorrectBuilder.customInterceptors().addInterceptor().position(InterceptorConfiguration.Position.FIRST)
               .interceptor(new BaseCustomInterceptor() {
                  @Override
                  protected void start() {
                     throw new IllegalStateException();
                  }
               });
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

   public void testKeyOnlyWrittenOnceOnOriginator() throws Exception {
      final Cache<MagicKey, String> cache1 = cache(0, CACHE_NAME);
      final Cache<MagicKey, String> cache2 = cache(1, CACHE_NAME);

      final CyclicBarrier barrier = new CyclicBarrier(2);
      cache1.getAdvancedCache().addInterceptor(new BaseCustomInterceptor() {
         @Override
         public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable {
            if (!ctx.isOriginLocal()) {
               // wait first before the check
               barrier.await(10, TimeUnit.SECONDS);
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

         cacheManager.defineConfiguration("correct-cache-1", cacheManager.getDefaultCacheConfiguration());
         cacheManager.defineConfiguration("correct-cache-2", cacheManager.getDefaultCacheConfiguration());
         cacheManager.defineConfiguration("correct-cache-3", cacheManager.getDefaultCacheConfiguration());
         ConfigurationBuilder incorrectBuilder = new ConfigurationBuilder();
         incorrectBuilder.customInterceptors().addInterceptor().position(InterceptorConfiguration.Position.FIRST)
               .interceptor(new BaseCustomInterceptor() {
                  @Override
                  protected void start() {
                     throw new IllegalStateException();
                  }
               });
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

   }

   private Configuration buildCfg(final int index, boolean clustered, boolean preload) {
      ConfigurationBuilder cb = new ConfigurationBuilder();
      cb.persistence().passivation(false);
      cb.customInterceptors().addInterceptor().index(0).interceptor(new BaseCustomInterceptor() {
         @Override
         public Object visitInvalidateCommand(InvocationContext ctx, InvalidateCommand invalidateCommand) throws Throwable {
            incrementCounter(invalidationCounts, index, invalidateCommand.getKeys().length);
            return invokeNextInterceptor(ctx, invalidateCommand);
         }
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

@Test(groups = "functional", testName = "tx.totalorder.CleanupAfterFailTest")
public class CleanupAfterFailTest extends MultipleCacheManagersTest {

   public void testTimeoutCleanup() throws Exception {
      final CountDownLatch block = new CountDownLatch(1);
      final CommandInterceptor interceptor = new BaseCustomInterceptor() {
         @Override
         public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable {
            block.await();
            return invokeNextInterceptor(ctx, command);
         }
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

      assertNoLocks();
   }

   public void testTimeoutCleanupInLocalNode() throws Exception {
      final CountDownLatch block = new CountDownLatch(1);
      final CommandInterceptor interceptor = new BaseCustomInterceptor() {
         @Override
         public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable {
            if (!ctx.isOriginLocal()) {
               block.await();
            }
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

   public void testKeyOnlyWrittenOnceOnOriginator() throws Exception {
      final Cache<MagicKey, String> cache1 = cache(0, CACHE_NAME);
      final Cache<MagicKey, String> cache2 = cache(1, CACHE_NAME);

      final CyclicBarrier barrier = new CyclicBarrier(2);
      cache1.getAdvancedCache().addInterceptor(new BaseCustomInterceptor() {
         @Override
         public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable {
            if (!ctx.isOriginLocal()) {
               // wait first before the check
               barrier.await(10, TimeUnit.SECONDS);
View Full Code Here

Examples of org.infinispan.interceptors.base.BaseCustomInterceptor

   }

   private Configuration buildCfg(final int index, boolean clustered, boolean preload) {
      ConfigurationBuilder cb = new ConfigurationBuilder();
      cb.persistence().passivation(false);
      cb.customInterceptors().addInterceptor().index(0).interceptor(new BaseCustomInterceptor() {
         @Override
         public Object visitInvalidateCommand(InvocationContext ctx, InvalidateCommand invalidateCommand) throws Throwable {
            incrementCounter(invalidationCounts, index, invalidateCommand.getKeys().length);
            return invokeNextInterceptor(ctx, invalidateCommand);
         }
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.