Examples of TransactionCoordinator


Examples of org.hibernate.engine.transaction.spi.TransactionCoordinator

      }
      return;
    }

    final SessionImplementor session = (SessionImplementor) internalGetSession();
    final TransactionCoordinator transactionCoordinator = session.getTransactionCoordinator();
    final TransactionImplementor transaction = transactionCoordinator.getTransaction();

    transaction.markForJoin();
    transactionCoordinator.pulse();

    LOG.debug( "Looking for a JTA transaction to join" );
    if ( ! transactionCoordinator.isTransactionJoinable() ) {
      if ( explicitRequest ) {
        // if this is an explicit join request, log a warning so user can track underlying cause
        // of subsequent exceptions/messages
        LOG.unableToJoinTransaction(Environment.TRANSACTION_STRATEGY);
      }
    }

    try {
      if ( transaction.getJoinStatus() == JoinStatus.JOINED ) {
        LOG.debug( "Transaction already joined" );
        return; // noop
      }

      // join the transaction and then recheck the status
      transaction.join();
      if ( transaction.getJoinStatus() == JoinStatus.NOT_JOINED ) {
        if ( explicitRequest ) {
          throw new TransactionRequiredException( "No active JTA transaction on joinTransaction call" );
        }
        else {
          LOG.debug( "Unable to join JTA transaction" );
          return;
        }
      }
      else if ( transaction.getJoinStatus() == JoinStatus.MARKED_FOR_JOINED ) {
        throw new AssertionFailure( "Transaction MARKED_FOR_JOINED after isOpen() call" );
      }

      // register behavior changes
      SynchronizationCallbackCoordinator callbackCoordinator = transactionCoordinator.getSynchronizationCallbackCoordinator();
      callbackCoordinator.setManagedFlushChecker( new ManagedFlushCheckerImpl() );
      callbackCoordinator.setExceptionMapper( new CallbackExceptionMapperImpl() );
      callbackCoordinator.setAfterCompletionAction( new AfterCompletionActionImpl( session, transactionType ) );
    }
    catch ( HibernateException he ) {
View Full Code Here

Examples of org.hibernate.engine.transaction.spi.TransactionCoordinator

      }
      return;
    }

    final SessionImplementor session = (SessionImplementor) getSession();
    final TransactionCoordinator transactionCoordinator = session.getTransactionCoordinator();
    final TransactionImplementor transaction = transactionCoordinator.getTransaction();

    transaction.markForJoin();
    transactionCoordinator.pulse();

    LOG.debug( "Looking for a JTA transaction to join" );
    if ( ! transactionCoordinator.isTransactionJoinable() ) {
      if ( explicitRequest ) {
        // if this is an explicit join request, log a warning so user can track underlying cause
        // of subsequent exceptions/messages
        LOG.unableToJoinTransaction(Environment.TRANSACTION_STRATEGY);
      }
    }

    try {
      if ( transaction.getJoinStatus() == JoinStatus.JOINED ) {
        LOG.debug( "Transaction already joined" );
        return; // noop
      }

      // join the transaction and then recheck the status
      transaction.join();
      if ( transaction.getJoinStatus() == JoinStatus.NOT_JOINED ) {
        if ( explicitRequest ) {
          throw new TransactionRequiredException( "No active JTA transaction on joinTransaction call" );
        }
        else {
          LOG.debug( "Unable to join JTA transaction" );
          return;
        }
      }
      else if ( transaction.getJoinStatus() == JoinStatus.MARKED_FOR_JOINED ) {
        throw new AssertionFailure( "Transaction MARKED_FOR_JOINED after isOpen() call" );
      }

      // register behavior changes
      SynchronizationCallbackCoordinator callbackCoordinator = transactionCoordinator.getSynchronizationCallbackCoordinator();
      callbackCoordinator.setManagedFlushChecker( new ManagedFlushCheckerImpl() );
      callbackCoordinator.setExceptionMapper( new CallbackExceptionMapperImpl() );
      callbackCoordinator.setAfterCompletionAction( new AfterCompletionActionImpl( session, transactionType ) );
    }
    catch ( HibernateException he ) {
View Full Code Here

Examples of org.hibernate.engine.transaction.spi.TransactionCoordinator

      }
      return;
    }

    final SessionImplementor session = (SessionImplementor) getSession();
    final TransactionCoordinator transactionCoordinator = session.getTransactionCoordinator();
    final TransactionImplementor transaction = transactionCoordinator.getTransaction();

    transaction.markForJoin();
    transactionCoordinator.pulse();

    LOG.debug( "Looking for a JTA transaction to join" );
    if ( ! transactionCoordinator.isTransactionJoinable() ) {
      if ( explicitRequest ) {
        // if this is an explicit join request, log a warning so user can track underlying cause
        // of subsequent exceptions/messages
        LOG.unableToJoinTransaction(Environment.TRANSACTION_STRATEGY);
      }
    }

    try {
      if ( transaction.getJoinStatus() == JoinStatus.JOINED ) {
        LOG.debug( "Transaction already joined" );
        return; // noop
      }

      // join the transaction and then recheck the status
      transaction.join();
      if ( transaction.getJoinStatus() == JoinStatus.NOT_JOINED ) {
        if ( explicitRequest ) {
          throw new TransactionRequiredException( "No active JTA transaction on joinTransaction call" );
        }
        else {
          LOG.debug( "Unable to join JTA transaction" );
          return;
        }
      }
      else if ( transaction.getJoinStatus() == JoinStatus.MARKED_FOR_JOINED ) {
        throw new AssertionFailure( "Transaction MARKED_FOR_JOINED after isOpen() call" );
      }

      // register behavior changes
      SynchronizationCallbackCoordinator callbackCoordinator = transactionCoordinator.getSynchronizationCallbackCoordinator();
      callbackCoordinator.setManagedFlushChecker( new ManagedFlushCheckerImpl() );
      callbackCoordinator.setExceptionMapper( new CallbackExceptionMapperImpl() );
      callbackCoordinator.setAfterCompletionAction( new AfterCompletionActionImpl( session, transactionType ) );
    }
    catch ( HibernateException he ) {
View Full Code Here

Examples of org.hibernate.engine.transaction.spi.TransactionCoordinator

      }
      return;
    }

    final SessionImplementor session = (SessionImplementor) getSession();
    final TransactionCoordinator transactionCoordinator = session.getTransactionCoordinator();
    final TransactionImplementor transaction = transactionCoordinator.getTransaction();

    transaction.markForJoin();
    transactionCoordinator.pulse();

    LOG.debug( "Looking for a JTA transaction to join" );
    if ( ! transactionCoordinator.isTransactionJoinable() ) {
      if ( explicitRequest ) {
        // if this is an explicit join request, log a warning so user can track underlying cause
        // of subsequent exceptions/messages
        LOG.unableToJoinTransaction(Environment.TRANSACTION_STRATEGY);
      }
    }

    try {
      if ( transaction.getJoinStatus() == JoinStatus.JOINED ) {
        LOG.debug( "Transaction already joined" );
        return; // noop
      }

      // join the transaction and then recheck the status
      transaction.join();
      if ( transaction.getJoinStatus() == JoinStatus.NOT_JOINED ) {
        if ( explicitRequest ) {
          throw new TransactionRequiredException( "No active JTA transaction on joinTransaction call" );
        }
        else {
          LOG.debug( "Unable to join JTA transaction" );
          return;
        }
      }
      else if ( transaction.getJoinStatus() == JoinStatus.MARKED_FOR_JOINED ) {
        throw new AssertionFailure( "Transaction MARKED_FOR_JOINED after isOpen() call" );
      }

      // register behavior changes
      SynchronizationCallbackCoordinator callbackCoordinator = transactionCoordinator.getSynchronizationCallbackCoordinator();
      callbackCoordinator.setManagedFlushChecker( new ManagedFlushCheckerImpl() );
      callbackCoordinator.setExceptionMapper( new CallbackExceptionMapperImpl() );
      callbackCoordinator.setAfterCompletionAction( new AfterCompletionActionImpl( session, transactionType ) );
    }
    catch ( HibernateException he ) {
View Full Code Here

Examples of org.infinispan.transaction.TransactionCoordinator

      xid = new DummyXid(uuid);
      localTx.setXid(xid);
      txTable.addLocalTransactionMapping(localTx);     

      configuration = new ConfigurationBuilder().build();
      txCoordinator = new TransactionCoordinator();
      txCoordinator.init(null, null, null, null, configuration);
      xaAdapter = new TransactionXaAdapter(localTx, txTable, null, txCoordinator, null, null,
                                           new ClusteringDependentLogic.InvalidationLogic(), configuration, "");
   }
View Full Code Here

Examples of org.infinispan.transaction.TransactionCoordinator

         } else if (componentType.equals(ActivationManager.class)) {
            return (T) new ActivationManagerImpl();
         } else if (componentType.equals(BatchContainer.class)) {
            return (T) new BatchContainer();
         } else if (componentType.equals(TransactionCoordinator.class)) {
            return (T) new TransactionCoordinator();
         } else if (componentType.equals(RecoveryAdminOperations.class)) {
            return (T) new RecoveryAdminOperations();
         } else if (componentType.equals(StateTransferLock.class)) {
            return (T) new StateTransferLockImpl();
         } else if (componentType.equals(EvictionManager.class)) {
View Full Code Here

Examples of org.infinispan.transaction.TransactionCoordinator

         } else if (componentType.equals(ActivationManager.class)) {
            return (T) new ActivationManagerImpl();
         } else if (componentType.equals(BatchContainer.class)) {
            return (T) new BatchContainer();
         } else if (componentType.equals(TransactionCoordinator.class)) {
            return (T) new TransactionCoordinator();
         } else if (componentType.equals(RecoveryAdminOperations.class)) {
            return (T) new RecoveryAdminOperations();
         } else if (componentType.equals(StateTransferLock.class)) {
            return (T) new StateTransferLockImpl();
         } else if (componentType.equals(EvictionManager.class)) {
View Full Code Here

Examples of org.infinispan.transaction.TransactionCoordinator

      xid = new DummyXid(uuid);
      localTx.setXid(xid);
      txTable.addLocalTransactionMapping(localTx);     

      configuration = new ConfigurationBuilder().build();
      txCoordinator = new TransactionCoordinator();
      txCoordinator.init(null, null, null, null, configuration);
      xaAdapter = new TransactionXaAdapter(localTx, txTable, null, txCoordinator, null, null,
                                           new ClusteringDependentLogic.InvalidationLogic(), configuration, "");
   }
View Full Code Here

Examples of org.infinispan.transaction.TransactionCoordinator

      c1.put(k1, "v1");
      c1.put(k2, "v2");

      // We split the transaction commit in two phases by calling the TransactionCoordinator methods directly
      TransactionTable txTable = TestingUtil.extractComponent(c1, TransactionTable.class);
      TransactionCoordinator txCoordinator = TestingUtil.extractComponent(c1, TransactionCoordinator.class);

      // Execute the prepare on both nodes
      LocalTransaction localTx = txTable.getLocalTransaction(tm(c1).getTransaction());
      txCoordinator.prepare(localTx);

      final CountDownLatch commitLatch = new CountDownLatch(1);
      Thread worker = new Thread("RehasherSim,StaleLocksWithCommitDuringStateTransferTest") {
         @Override
         public void run() {
View Full Code Here

Examples of org.infinispan.transaction.TransactionCoordinator

      c1.put(k1, "v1");
      c1.put(k2, "v2");

      // We split the transaction commit in two phases by calling the TransactionCoordinator methods directly
      TransactionTable txTable = TestingUtil.extractComponent(c1, TransactionTable.class);
      TransactionCoordinator txCoordinator = TestingUtil.extractComponent(c1, TransactionCoordinator.class);

      // Execute the prepare on both nodes
      LocalTransaction localTx = txTable.getLocalTransaction(tm(c1).getTransaction());
      txCoordinator.prepare(localTx);

      // Delay the commit on the remote node. Can't used blockNewTransactions because we don't want a StateTransferInProgressException
      InterceptorChain c2ic = TestingUtil.extractComponent(c2, InterceptorChain.class);
      c2ic.addInterceptorBefore(new CommandInterceptor() {
         protected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable {
            if (command instanceof CommitCommand) {
               Thread.sleep(3000);
            }
            return super.handleDefault(ctx, command);
         }
      }, StateTransferInterceptor.class);

      // Schedule the remote node to stop on another thread since the main thread will be busy with the commit call
      Thread worker = new Thread("RehasherSim,StaleLocksWithCommitDuringStateTransferTest") {
         @Override
         public void run() {
            try {
               // should be much larger than the lock acquisition timeout
               Thread.sleep(1000);
               manager(c2).stop();
               // stLock.unblockNewTransactions(1000);
            } catch (InterruptedException e) {
               log.errorf(e, "Error stopping cache");
            }
         }
      };
      worker.start();

      try {
         // finally commit or rollback the transaction
         if (commit) {
            txCoordinator.commit(localTx, false);
         } else {
            txCoordinator.rollback(localTx);
         }

         // make the transaction manager forget about our tx so that we don't get rollback exceptions in the log
         tm(c1).suspend();
      } finally {
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.