Package org.jboss.cache

Examples of org.jboss.cache.GlobalTransaction


      tx.begin();
      cache.remove("/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


   }


   public void testNodeDeletionRollback3() throws Exception{
      GlobalTransaction gtx;
      cache.put("/a/b/c1", null);

      tx.begin();
      gtx=cache.getCurrentTransaction();
      cache.put("/a/b/c1", null);
View Full Code Here

      assertEquals("c1", cn.iterator().next());
   }

   public void testDoubleLocks() throws Exception{
      tx.begin();
      GlobalTransaction gtx = cache.getCurrentTransaction();
      cache.put("/a/b/c", null);
      cache.put("/a/b/c", null);

      DataNode n=cache.get("/a");
      IdentityLock lock=n.getLock();
View Full Code Here

   }

   public void testKnownTypeMagicNumbers() throws Exception
   {
      doMagicNumberTest(new Fqn(), TreeCacheMarshaller140.MAGICNUMBER_FQN);
      doMagicNumberTest(new GlobalTransaction(), TreeCacheMarshaller140.MAGICNUMBER_GTX);
      doMagicNumberTest(new IpAddress(), TreeCacheMarshaller140.MAGICNUMBER_IPADDRESS);
      doMagicNumberTest(new Integer(10), TreeCacheMarshaller140.MAGICNUMBER_INTEGER);
      doMagicNumberTest(new Long(10), TreeCacheMarshaller140.MAGICNUMBER_LONG);
      doMagicNumberTest(Boolean.TRUE, TreeCacheMarshaller140.MAGICNUMBER_BOOLEAN);
      doMagicNumberTest("HELLO", TreeCacheMarshaller140.MAGICNUMBER_STRING);
View Full Code Here

                {
                    // if method is a CRUD (Create/Remove/Update/Delete) method: add it to the modification
                    // list, otherwise skip (e.g. get() is not added)
                    // add the modification to the TX's modification list. this is used to later
                    // (on TX commit) send all modifications done in this TX to all members
                    GlobalTransaction gtx = ctx.getGlobalTransaction();
                    if (gtx == null)
                    {
                        if (log.isDebugEnabled())
                        {
                            log.debug("didn't find GlobalTransaction for " + tx + "; won't add modification to transaction list");
View Full Code Here

      // is this a node removal operation?
      boolean nodeRemoved = false;
     
      // Could be TRANSACTIONAL. If so, we register for TX completion (if we haven't done so yet)
      if(tx_mgr != null && tx_mgr.getTransaction() != null) {
         GlobalTransaction gtx = getInvocationContext().getGlobalTransaction();
         switch (m.getMethodId())
         {
            case MethodDeclarations.commitMethod_id:
               if (hasModifications(args)) {
                  loader.commit(gtx);
View Full Code Here

        //start local transaction
        mgr.begin();
        Transaction tx = mgr.getTransaction();

        //this sets
        GlobalTransaction gtx = cache.getCurrentTransaction(tx);

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);
View Full Code Here

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);

        GlobalTransaction gtx = cache.getCurrentTransaction(tx);
        TransactionTable table = cache.getTransactionTable();
        assertNotNull(mgr.getTransaction());
        mgr.commit();

View Full Code Here

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);

        GlobalTransaction gtx = cache.getCurrentTransaction(tx);
        TransactionTable table = cache.getTransactionTable();
        OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
        assertNotNull(mgr.getTransaction());
        mgr.commit();


        GlobalTransaction remoteGtx = new GlobalTransaction();

        remoteGtx.setAddress(new Address()
        {
            public boolean isMulticastAddress()
            {

                return false;
            }

            public void readExternal(ObjectInput arg0) throws IOException,
                    ClassNotFoundException
            {


            }

            public void writeExternal(ObjectOutput arg0) throws IOException
            {


            }

            public int compareTo(Object arg0)
            {

                return 0;
            }

            public int size()
            {

                return 0;
            }

            public void writeTo(DataOutputStream arg0) throws IOException
            {


            }

            public void readFrom(DataInputStream arg0) throws IOException, IllegalAccessException, InstantiationException
            {


            }
        });
        //hack the method call to make it have the remote gtx
        MethodCall meth = (MethodCall) entry.getModifications().get(0);

        meth.getArgs()[0] = remoteGtx;
        //call our remote method
        MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, new Object[]{remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE});
        try
        {
            cache._replicate(prepareMethod);
        }
        catch (Throwable t)
View Full Code Here

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);

        GlobalTransaction gtx = cache.getCurrentTransaction(tx);
        TransactionTable table = cache.getTransactionTable();
        OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
        assertNotNull(mgr.getTransaction());
        mgr.commit();


        GlobalTransaction remoteGtx = new GlobalTransaction();

        remoteGtx.setAddress(new Address()
        {
            public boolean isMulticastAddress()
            {

                return false;
            }

            public void readExternal(ObjectInput arg0) throws IOException,
                    ClassNotFoundException
            {


            }

            public void writeExternal(ObjectOutput arg0) throws IOException
            {


            }

            public int compareTo(Object arg0)
            {

                return 0;
            }

            public int size()
            {

                return 0;
            }

            public void writeTo(DataOutputStream arg0) throws IOException
            {


            }

            public void readFrom(DataInputStream arg0) throws IOException, IllegalAccessException, InstantiationException
            {


            }
        });
        //hack the method call to make it have the remote gtx
        MethodCall meth = (MethodCall) entry.getModifications().get(0);

        meth.getArgs()[0] = remoteGtx;
        //call our remote method
        MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, new Object[]{remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE});
        try
        {
            cache._replicate(prepareMethod);
        }
        catch (Throwable t)
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.