Apache.NMS.ISession.Rollback()

Here are the examples of the csharp api class Apache.NMS.ISession.Rollback() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6 Examples 7

1. Example

Project: spring-net
Source File: CachedSession.cs
public void Rollback()
        {
            this.transactionOpen = false;
            target.Rollback();
        }

2. Example

Project: spring-net
Source File: NmsTransactionManager.cs
protected override void DoRollback(DefaultTransactionStatus status)
        {
            MessageTransactionObject txObject = (MessageTransactionObject)status.Transaction;
            ISession session = txObject.ResourceHolder.GetSession();
            try
            {
                if (status.Debug)
                {
                    LOG.Debug("Rolling back NMS transaction on Session [" + session + "]");
                }
                session.Rollback();              
            }
            catch (NMSException ex)
            {
                throw new TransactionSystemException("Could not roll back NMS transaction.", ex);
            }
        }

3. Example

Project: spring-net
Source File: MessageUtils.cs
public static void RollbackIfNecessary(ISession session)
        {
		    AssertUtils.ArgumentNotNull(session, "ISession must not be null");
			session.Rollback();

			// TODO Investigate

//		    try {
//			    session.Rollback();
//		    }
//		    catch (TransactionInProgressException ex) {
//			    // Ignore -> can only happen in case of a JTA transaction.
//		    }
//		    catch (IllegalStateException ex) {
//			    // Ignore -> can only happen in case of a JTA transaction.
//		    }
	    }

4. Example

Project: spring-net
Source File: CachedSession.cs
private void LogicalClose()
        {
            // Preserve rollback-on-close semantics.
            if (this.transactionOpen && this.target.Transacted)
            {
                this.transactionOpen = false;
                this.target.Rollback();
            }

            // Physically close durable subscribers at time of Session close call.
            List<ConsumerCacheKey> toRemove = new List<ConsumerCacheKey>();
            foreach (DictionaryEntry dictionaryEntry in cachedConsumers)
            {
                ConsumerCacheKey key = (ConsumerCacheKey) dictionaryEntry.Key;
                if (key.Subscription != null)
                {
                    ((IMessageConsumer) dictionaryEntry.Value).Close();
                    toRemove.Add(key);
                }                
            }
            foreach (ConsumerCacheKey key in toRemove)
            {
                cachedConsumers.Remove(key);
            }

            // Allow for multiple close calls...
            if (!sessionList.Contains(this))
            {
                #region Logging

                if (LOG.IsDebugEnabled)
                {
                    LOG.Debug("Returning cached Session: " + target);
                }

                #endregion

                sessionList.Add(this); //add to end of linked list.
            }
        }

5. Example

Project: spring-net
Source File: MessageTransactionManagerTests.cs
private static void SetupRollbackExpectations(IConnection connection, IConnectionFactory connectionFactory, ISession session)
        {
            Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once();
            Expect.Call(connection.CreateSession(AcknowledgementMode.Transactional)).Return(session).Repeat.Once();
            session.Rollback();
            LastCall.On(session).Repeat.Once();
            session.Close();
            LastCall.On(session).Repeat.Once();
            connection.Close();
            LastCall.On(connection).Repeat.Once();
        }

6. Example

Project: spring-net
Source File: SingleConnectionFactoryTests.cs
[Test]
        public void CachingConnectionFactory()
        {
            IConnectionFactory conne/n ..... /n //View Source file for more details /n }