Package org.infinispan.context.impl

Examples of org.infinispan.context.impl.NonTxInvocationContext


         LocalTransaction localTransaction = transactionTable.getLocalTransaction(tx);
         localContext.setLocalTransaction(localTransaction);
         localContext.setTransaction(tx);
         return localContext;
      } else {
         NonTxInvocationContext nonTxContext;
         if ((existing == null) || !(existing instanceof NonTxInvocationContext)) {
            nonTxContext = new NonTxInvocationContext();
            icTl.set(nonTxContext);
         } else {
            nonTxContext = (NonTxInvocationContext) existing;
         }
         nonTxContext.setOriginLocal(true);
         return nonTxContext;
      }
   }
View Full Code Here


   }

   public NonTxInvocationContext createNonTxInvocationContext() {
      InvocationContext existing = icTl.get();
      if (existing != null && existing instanceof NonTxInvocationContext) {
         NonTxInvocationContext context = (NonTxInvocationContext) existing;
         context.setOriginLocal(true);
         return context;
      }
      NonTxInvocationContext remoteTxContext = new NonTxInvocationContext();
      icTl.set(remoteTxContext);
      return remoteTxContext;
   }
View Full Code Here

   }

   public NonTxInvocationContext createRemoteInvocationContext(Address origin) {
      InvocationContext existing = icTl.get();
      if (existing != null && existing instanceof NonTxInvocationContext) {
         NonTxInvocationContext context = (NonTxInvocationContext) existing;
         context.setOriginLocal(false);
         context.setOrigin(origin);
         return context;
      }
      NonTxInvocationContext remoteNonTxContext = new NonTxInvocationContext();
      remoteNonTxContext.setOriginLocal(false);
      remoteNonTxContext.setOrigin(origin);
      icTl.set(remoteNonTxContext);
      return remoteNonTxContext;
   }
View Full Code Here

      return ctx;
   }

   @Override
   public NonTxInvocationContext createRemoteInvocationContext(Address origin) {
      final NonTxInvocationContext nonTxInvocationContext = newNonTxInvocationContext(false);
      nonTxInvocationContext.setOrigin(origin);
      return nonTxInvocationContext;
   }
View Full Code Here

         throw new CacheException(e);
      }
   }

   protected final NonTxInvocationContext newNonTxInvocationContext(boolean local) {
      NonTxInvocationContext ctx = new NonTxInvocationContext();
      ctx.setOriginLocal(local);
      ctxHolder.set(ctx);
      return ctx;
   }
View Full Code Here

      mockCache = mock(Cache.class);
      n.injectDependencies(mockCache, new ClusteringDependentLogic.LocalLogic(), null);
      cl = new CacheListener();
      n.start();
      n.addListener(cl, kf);
      ctx = new NonTxInvocationContext(AnyEquivalence.getInstance());
   }
View Full Code Here

      mockCache = mock(Cache.class);
      n.injectDependencies(mockCache, new ClusteringDependentLogic.LocalLogic(), null);
      cl = new CacheListener();
      n.start();
      n.addListener(cl);
      ctx = new NonTxInvocationContext(AnyEquivalence.getInstance());
   }
View Full Code Here

      assert !((TransactionCompletedEvent) cl.getEvents().get(1)).isTransactionSuccessful();
      assert ((TransactionCompletedEvent) cl.getEvents().get(1)).getGlobalTransaction() == tx;
   }

   public void testNotifyTransactionRegistered() {
      InvocationContext ctx = new NonTxInvocationContext(AnyEquivalence.getInstance());
      GlobalTransaction tx = mock(GlobalTransaction.class);
      n.notifyTransactionRegistered(tx, ctx);
      n.notifyTransactionRegistered(tx, ctx);

      assert cl.getInvocationCount() == 2;
View Full Code Here

      mockCache = mock(Cache.class);
      n.injectDependencies(mockCache, cdl, null);
      cl = new PrimaryOwnerCacheListener();
      n.start();
      n.addListener(cl);
      ctx = new NonTxInvocationContext(AnyEquivalence.getInstance());
   }
View Full Code Here

    * @return returns an <code>CacheEntry</code> or null, if no entry is found.
    */
   public InternalCacheValue perform(InvocationContext context) throws Throwable {
      GetKeyValueCommand command = commandsFactory.buildGetKeyValueCommand(key);
      command.setReturnCacheEntry(true);
      NonTxInvocationContext invocationContext = icc.createRemoteInvocationContext();
      CacheEntry cacheEntry = (CacheEntry) invoker.invoke(invocationContext, command);
      if (cacheEntry == null) {
         if (trace) log.trace("Did not find anything, returning null");
         return null;
      }
View Full Code Here

TOP

Related Classes of org.infinispan.context.impl.NonTxInvocationContext

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.