Package org.jboss.cache

Examples of org.jboss.cache.InvocationContext


   private InvocationContext resetInvocationContext(InvocationContext ctx)
   {
      // wipe current context.
      cache.setInvocationContext(null);
      // get a new Invocation Context
      InvocationContext newContext = cache.getInvocationContext();
      newContext.putLookedUpNodes(ctx.getLookedUpNodes());
      return ctx;
   }
View Full Code Here


   private void removeFromTreeCache(Fqn<?> fqn, boolean localOnly) throws Exception
   {
      if (localOnly)
      {
         InvocationContext ctx = cache.getInvocationContext();
         Option option = new Option();
         option.setCacheModeLocal(true);
         ctx.setOptionOverrides(option);
      }
      cache.removeNode(fqn);
   }
View Full Code Here

   private void removeFromTreeCache(Fqn<?> fqn, boolean localOnly) throws Exception
   {
      if (localOnly)
      {
         InvocationContext ctx = cache.getInvocationContext();
         Option option = new Option();
         option.setCacheModeLocal(true);
         ctx.setOptionOverrides(option);
      }
      cache.removeNode(fqn);
   }
View Full Code Here

      command.initialize(container);
   }

   public void testPerform()
   {
      InvocationContext ctx = new MVCCInvocationContext();
      ctx.putLookedUpNode(testFqn, null);
      assert !((Boolean) command.perform(ctx));

      ctx.putLookedUpNode(testFqn, new NodeSpiMock(testFqn));

      assert Boolean.TRUE == command.perform(ctx);
   }
View Full Code Here

   private boolean executeRemove(GlobalTransaction gtx, Fqn toRemove) throws Throwable
   {
      Object result;
      RemoveNodeCommand removeBackupCommand = commandsFactory.buildRemoveNodeCommand(gtx, toRemove);

      InvocationContext ctx = invoker.getInvocationContext();
      ctx.getOptionOverrides().setCacheModeLocal(true);
      result = invoker.invoke(ctx, removeBackupCommand);
      return result != null && (Boolean) result;
   }
View Full Code Here

      Object callResults = null;
      try
      {
         if (trace) log.trace("Clustered get: invoking call with Fqn " + dataCommand.getFqn());
         InvocationContext ctx = interceptorChain.getInvocationContext();
         ctx.setOriginLocal(false);
         // very hacky to be calling this command directly.
         callResults = dataCommand.perform(ctx);
         boolean found = validResult(callResults);
         if (trace) log.trace("Got result " + callResults + ", found=" + found);
         if (found && callResults == null) callResults = createEmptyResults();
View Full Code Here

   {
      AbstractLockManagerRecordingTestTL tl = threadLocal.get();
      LockManager lm = tl.lm;
      Fqn fqn = Fqn.fromString("/a/b/c");
      NodeSPI node = createNode(fqn);
      InvocationContext ctx = tl.icc.get();

      // lock and record.
      lm.lockAndRecord(node, WRITE, ctx);
      assert ctx.getLocks().contains(fqnBasedLocking ? fqn : node.getLock());
      assert ctx.getLocks().size() == 1;
      assert lm.isLocked(node) : "Should be locked";
      lm.unlock(ctx);
      assert !lm.isLocked(node) : "Should not be locked";
   }
View Full Code Here

   {
      AbstractLockManagerRecordingTestTL tl = threadLocal.get();
      LockManager lm = tl.lm;
      Fqn fqn = Fqn.fromString("/a/b/c");
      NodeSPI node = createNode(fqn);
      InvocationContext ctx = tl.icc.get();
      ctx.setGlobalTransaction(new GlobalTransaction());
      ctx.setTransaction(new DummyTransaction(DummyTransactionManager.getInstance()));
      ctx.setTransactionContext(tl.contextFactory.createTransactionContext(ctx.getTransaction()));

      // lock and record.
      lm.lockAndRecord(node, WRITE, ctx);
      assert ctx.getLocks().contains(fqnBasedLocking ? fqn : node.getLock());
      assert ctx.getTransactionContext().getLocks().size() == 1;
      assert lm.isLocked(node) : "Should be locked";
      lm.unlock(ctx);
      assert !lm.isLocked(node) : "Should not be locked";
   }
View Full Code Here

      }
   }

   private void assertInvocationContextInitState(Cache c)
   {
      InvocationContext ctx = c.getInvocationContext();
      InvocationContext control;
      control = ctx.copy();

      control.reset();

      assertEquals("Should be equal", control, ctx);
   }
View Full Code Here

   public boolean exists(Fqn fqn)
   {
      if (usingMvcc)
      {
         InvocationContext ctx = invocationContextContainer.get();
         cacheStatusCheck(ctx);
         ExistsCommand command = commandsFactory.buildExistsNodeCommand(fqn);
         return (Boolean) invoker.invoke(ctx, command);
      }
      else
View Full Code Here

TOP

Related Classes of org.jboss.cache.InvocationContext

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.