Package org.jboss.cache

Examples of org.jboss.cache.GlobalTransaction


   }

   protected void nullOwner() throws InterruptedException {
      log("testNullOwner ...");
      try {
         GlobalTransaction gtx = getGlobalTransactionFromThread();
         lock_.acquireWriteLock(gtx, 50);
         lock_.release(gtx);

         lock_.acquireReadLock(gtx, 50);
         lock_.release(gtx);
View Full Code Here


   }

   protected void nullOwner2() throws InterruptedException {
      log("testNullOwner2 ...");
      try {
         GlobalTransaction gtx = getGlobalTransactionFromThread();
         lock_.acquireReadLock(gtx, 50);
         lock_.acquireWriteLock(gtx, 50); // this should succeed
         lock_.release(gtx);
      } catch (LockingException e) {
         fail(e.toString());
View Full Code Here

   }

   public void nullOwner3() throws InterruptedException {
      log("testNullOwner3 ...");
      try {
         GlobalTransaction gtx = getGlobalTransactionFromThread();
         lock_.acquireWriteLock(gtx, 50);
         lock_.acquireReadLock(gtx, 50); // this should succeed
         lock_.release(gtx);
      } catch (LockingException e) {
         fail(e.toString());
View Full Code Here

    public Object invoke(MethodCall call) throws Throwable
    {

        JBCMethodCall m = (JBCMethodCall) call;
        InvocationContext ctx = getInvocationContext();
        GlobalTransaction gtx = ctx.getGlobalTransaction();

       // bypass for buddy group org metod calls.
       if (isBuddyGroupOrganisationMethod(m)) return super.invoke(m);
      

        boolean isLocalCommitOrRollback = gtx != null && !gtx.isRemote() && (m.getMethodId() == MethodDeclarations.commitMethod_id || m.getMethodId() == MethodDeclarations.rollbackMethod_id);


        // pass up the chain if not a local commit or rollback (in which case replicate first)
        Object o = isLocalCommitOrRollback ? null : super.invoke(m);

        Option optionOverride = ctx.getOptionOverrides();

        if (optionOverride != null && optionOverride.isCacheModeLocal() && ctx.getTransaction() == null)
        {
            log.trace("skip replication");
            return isLocalCommitOrRollback ? super.invoke(m) : o;
        }

        Method method = m.getMethod();

        // could be potentially TRANSACTIONAL. If so, we register for transaction completion callbacks (if we
        // have not yet done so
        if (ctx.getTransaction() != null)
        {
            if (gtx != null && !gtx.isRemote())
            {
                // lets see what sort of method we've got.
               switch(m.getMethodId())
               {
                  case MethodDeclarations.commitMethod_id:
View Full Code Here

   }



    public void testNodeCreation() throws Exception {
      GlobalTransaction gtx;
      cache.put("/a/b", null);
      tx.begin();
      gtx=cache.getCurrentTransaction();
      cache.put("/a/b/c", null);
      assertLocked(gtx, "/a", false);
View Full Code Here

      System.out.println("locks: " + cache.printLockInfo());
   }


    public void testNodeCreation2() throws Exception {
      GlobalTransaction gtx;
      tx.begin();
      gtx=cache.getCurrentTransaction();
      cache.put("/a/b/c", null);
      assertLocked(gtx, "/a", true);
      assertLocked(gtx, "/a/b", true);
View Full Code Here

      System.out.println("locks: " + cache.printLockInfo());
   }


    public void testNodeRemoval() {
      GlobalTransaction gtx;
      try {
         cache.put("/a/b/c", null);
         tx.begin();
         gtx=cache.getCurrentTransaction();
         cache.remove("/a/b/c"); // need to remove the node, not just the data in the node.
View Full Code Here

      }
   }


   public void testNodeRemoval2() {
     GlobalTransaction gtx;
     try {
        cache.put("/a/b/c", null);
        tx.begin();
        gtx=cache.getCurrentTransaction();
        cache.remove("/a/b"); // need to remove the node, not just the data in the node.
View Full Code Here

  {
     cache.put("/a", null);
     tx.begin();
     cache.put("/a/b/c", null);
     // expecting WLs on /a, /a/b and /a/b/c.
     GlobalTransaction gtx=cache.getCurrentTransaction();
     assertLocked(gtx, "/a", true);
     assertLocked(gtx, "/a/b", true);
     assertLocked(gtx, "/a/b/c", true);
     tx.rollback();
View Full Code Here

     tx.begin();
     cache.get("/a/b/c");

     // expecting RLs on /, /a
     // /a/b, /a/b/c should NOT be created!
     GlobalTransaction gtx=cache.getCurrentTransaction();
     assertLocked(gtx, "/", false);
     assertLocked(gtx, "/a", false);
     assertNull("/a/b should not exist", cache.peek(Fqn.fromString("/a/b")));
     assertNull("/a/b/c should not exist", cache.peek(Fqn.fromString("/a/b/c")));
     tx.rollback();
View Full Code Here

TOP

Related Classes of org.jboss.cache.GlobalTransaction

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.