Examples of registerSynchronization()


Examples of javax.transaction.Transaction.registerSynchronization()

    if ( currentSession == null ) {
      currentSession = buildOrObtainSession();

      try {
        txn.registerSynchronization( buildCleanupSynch( txn ) );
      }
      catch ( Throwable t ) {
        try {
          currentSession.close();
        }
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

    if ( currentSession == null ) {
      currentSession = buildOrObtainSession();

      try {
        txn.registerSynchronization( buildCleanupSynch( txnIdentifier ) );
      }
      catch ( Throwable t ) {
        try {
          currentSession.close();
        }
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

      cache.put("/one/two/three", "key1", "val1");
      numLocks = cache.getNumberOfLocksHeld();
      assertEquals(4, numLocks);

      // we register *second*
      tx.registerSynchronization(new Synchronization()
      {

         public void beforeCompletion()
         {
            try
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

      cache.put("/one/two/three", "key1", "val1");
      numLocks = cache.getNumberOfLocksHeld();
      assertEquals(4, numLocks);

      // we register *second*
      tx.registerSynchronization(new Synchronization()
      {

         public void beforeCompletion()
         {
         }
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

      cacheB.put("/1/A/I", "2", "B");
      cacheB.put("/EXISTS", "KEY", "B");

      Object monitor = new Object();
      HangSync sync = new HangSync(monitor);
      tx.registerSynchronization(sync);

      Thread t = new Thread()
      {
         public void run()
         {
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

      System.out.println("cache1 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache1));
      System.out.println("cache2 (before commit):\n" + CachePrinter.printCacheLockingInfo(cache2));

      // this will rollback the transaction
      Transaction tx = tm.getTransaction();
      tx.registerSynchronization(new TransactionAborter(tx));

      try
      {
         tm.commit();
         fail("commit should throw a RollbackException, we should not get here");
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

            {
               Transaction tx = callbackTM.getTransaction();
               if (tx != null && tx.getStatus() == Status.STATUS_ACTIVE)
               {
                  // this will rollback the transaction
                  tx.registerSynchronization(new TransactionAborter(tx));
               }
               else
               {
                  super.nodeModified(ne);
               }
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

      TransactionManager tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();

      tm.begin();
      Transaction tx = tm.getTransaction();
      UpdateTimestampsSynchronization sync = new UpdateTimestampsSynchronization(ENTITY_TYPE_FQN, cache, tm);
      tx.registerSynchronization(sync);

      Fqn fqn = Fqn.fromRelativeFqn(REGION_PREFIX_FQN, ENTITY_TYPE_FQN);
      fqn = Fqn.fromRelativeElements(fqn, "1");
      cache.put(fqn, ITEM, "value");
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

            assertNotNull("TransactionManager not null", tm);

            Transaction tx = tm.getTransaction();
            assertNotNull("Transaction not null", tx);

            tx.registerSynchronization(txObj);

            txObj.setMessage("Donate $1.000.000");
            assertNull("Uncommited message null", txObj.getMessage());

            userTx.commit();
View Full Code Here

Examples of javax.transaction.Transaction.registerSynchronization()

    private void registerSynchronization(Synchronization synchronization) {
        try {
            final Transaction tx = this.getTransaction();
            // register for lifecycle events of transaction
            tx.registerSynchronization(synchronization);
        } catch (RollbackException e) {
            throw new EJBException(e);
        } catch (SystemException e) {
            throw new EJBException(e);
        }
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.