Package org.springframework.transaction

Examples of org.springframework.transaction.TransactionStatus


  public void testOutboundWithRollback() throws Exception {
    //Update the field and send a JMS message in a JTA transaction
    DefaultTransactionDefinition definition=new DefaultTransactionDefinition();
    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);

      //JDBC
      JdbcTemplate jdbcTemplate=new JdbcTemplate(getDataSource());
View Full Code Here


  protected boolean receiveAndExecute(Object invoker, Session session, MessageConsumer consumer)
      throws JMSException {

    if (this.transactionManager != null) {
      // Execute receive within transaction.
      TransactionStatus status = this.transactionManager.getTransaction(this.transactionDefinition);
      boolean messageReceived = true;
      try {
        messageReceived = doReceiveAndExecute(invoker, session, consumer, status);
      }
      catch (JMSException ex) {
View Full Code Here

  /**
   * Register jobs and triggers (within a transaction, if possible).
   */
  private void registerJobsAndTriggers() throws SchedulerException {
    TransactionStatus transactionStatus = null;
    if (this.transactionManager != null) {
      transactionStatus = this.transactionManager.getTransaction(new DefaultTransactionDefinition());
    }
    try {

View Full Code Here

            // under spring. So we try to join the existing one, and if we can't, it's not active
            // (We could inspect the transaction data stack for the thread, but this isn't guaranteed
            // if the user has created transactions for themselves)
            try {
                PlatformTransactionManager qq_txn1 = pDataSource.getTransactionManager();
                TransactionStatus aTxnStatus = qq_txn1.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_MANDATORY));
                qq_txn1.commit(aTxnStatus);
                return true;
            }
            catch (Exception e) {
                return false;
View Full Code Here

        // NESTED transactions get whether to commit or rollback from their outermost transaction
        // so ignore them unless they are the only transaction on the stack (in which case they
        // should be flagged as INDEPENDENT transaction, but it doesn't hurt to check)
        // TF:27/04/2008:Changed the check of the size to 0, as we've popped the top of the stack
        if (transactionData.type != TransactionType.NESTED || currentTransactions.size() == 0) {
            TransactionStatus currentStatus = transactionData.getStatus();
            PlatformTransactionManager aTxn = transactionData.getManager();
            if (currentStatus != null && aTxn != null) {
                _log.debug("Rollback Transaction: " + transactionData);
                aTxn.rollback(currentStatus);
            }
View Full Code Here

        // NESTED transactions get whether to commit or rollback from their outermost transaction
        // so ignore them unless they are the only transaction on the stack (in which case they
        // should be flagged as INDEPENDENT transaction, but it doesn't hurt to check)
        // TF:27/04/2008:Changed the check of the size to 0, as we've popped the top of the stack
        if (transactionData.type != TransactionType.NESTED || currentTransactions.size() == 0) {
            TransactionStatus currentStatus = transactionData.getStatus();
            PlatformTransactionManager aTxn = transactionData.getManager();
            if (aTxn != null && currentStatus != null) {
                if (transactionData.rolledBack) {
                    // Something has previously rolled back, forcing this transaction to rollback
                  if (_log.isDebugEnabled()) {
View Full Code Here

  protected boolean receiveAndExecute(Object invoker, Session session, MessageConsumer consumer)
      throws JMSException {

    if (this.transactionManager != null) {
      // Execute receive within transaction.
      TransactionStatus status = this.transactionManager.getTransaction(this.transactionDefinition);
      boolean messageReceived;
      try {
        messageReceived = doReceiveAndExecute(invoker, session, consumer, status);
      }
      catch (JMSException ex) {
View Full Code Here

  /**
   * Register jobs and triggers (within a transaction, if possible).
   */
  protected void registerJobsAndTriggers() throws SchedulerException {
    TransactionStatus transactionStatus = null;
    if (this.transactionManager != null) {
      transactionStatus = this.transactionManager.getTransaction(new DefaultTransactionDefinition());
    }
    try {

View Full Code Here

            // under spring. So we try to join the existing one, and if we can't, it's not active
            // (We could inspect the transaction data stack for the thread, but this isn't guaranteed
            // if the user has created transactions for themselves)
            try {
                PlatformTransactionManager qq_txn1 = pDataSource.getTransactionManager();
                TransactionStatus aTxnStatus = qq_txn1.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_MANDATORY));
                qq_txn1.commit(aTxnStatus);
                return true;
            }
            catch (Exception e) {
                return false;
View Full Code Here

        // NESTED transactions get whether to commit or rollback from their outermost transaction
        // so ignore them unless they are the only transaction on the stack (in which case they
        // should be flagged as INDEPENDENT transaction, but it doesn't hurt to check)
        // TF:27/04/2008:Changed the check of the size to 0, as we've popped the top of the stack
        if (transactionData.type != TransactionType.NESTED || currentTransactions.size() == 0) {
            TransactionStatus currentStatus = transactionData.getStatus();
            PlatformTransactionManager aTxn = transactionData.getManager();
            if (currentStatus != null && aTxn != null) {
                _log.debug("Rollback Transaction: " + transactionData);
                aTxn.rollback(currentStatus);
            }
View Full Code Here

TOP

Related Classes of org.springframework.transaction.TransactionStatus

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.