Here are the examples of the csharp api class Apache.NMS.IConnection.Close() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
18 Examples
0
1. Example
Project: spring-net
Source File: ConnectionFactoryUtils.cs
Source File: ConnectionFactoryUtils.cs
public static void ReleaseConnection(IConnection connection, IConnectionFactory cf, bool started) { if (connection == null) { return; } if (started && cf is ISmartConnectionFactory && ((ISmartConnectionFactory)cf).ShouldStop(connection)) { try { connection.Stop(); } catch (Exception ex) { LOG.Debug("Could not stop NMS Connection before closing it", ex); } } try { connection.Close(); } catch (Exception ex) { LOG.Debug("Could not close NMS Connection", ex); } }
0
2. Example
Project: spring-net
Source File: SingleConnectionFactory.cs
Source File: SingleConnectionFactory.cs
protected virtual void CloseConnection(IConnection con) { if (LOG.IsDebugEnabled) { LOG.Debug("Closing shared NMS Connection: " + this.target); } try { try { if (this.started) { this.started = false; con.Stop(); } } finally { con.Close(); } } catch (Exception ex) { LOG.Warn("Could not close shared NMS connection.", ex); } }
0
3. Example
Project: spring-net
Source File: MessageUtils.cs
Source File: MessageUtils.cs
public static void CloseConnection(IConnection con, bool stop) { if (con != null) { try { if (stop) { try { con.Stop(); } finally { con.Close(); } } else { con.Close(); } } catch (NMSException ex) { logger.Debug("Could not close NMS Connection", ex); } catch (Exception ex) { // We don't trust the NMS provider: It might throw another exception. logger.Debug("Unexpected exception on closing NMS Connection", ex); } } }
0
4. Example
Project: nova
Source File: ActiveMQSender.cs
Source File: ActiveMQSender.cs
public string close(Dictionary<string, object> parameters) { try { string uri = (string)parameters["uri"]; string topic = (string)parameters["topic"]; session.Close(); connection.Close(); } catch (Exception ex) { return ex.ToString(); } return null; }
0
5. Example
Project: spring-net
Source File: MessageTemplateTests.cs
Source File: MessageTemplateTests.cs
private void CloseProducerSessionConnection(IMessageProducer mockProducer) { mockProducer.Close(); LastCall.On(mockProducer).Repeat.Once(); mockSession.Close(); LastCall.On(mockSession).Repeat.Once(); mockConnection.Close(); LastCall.On(mockConnection).Repeat.Once(); }
0
6. Example
Project: spring-net
Source File: MessageTemplateTests.cs
Source File: MessageTemplateTests.cs
[Test] public void SessionCallback() { NmsTemplate template = CreateTemplate(); template.ConnectionFactory = mockConnectionFactory; mockSession.Close(); LastCall.On(mockSession).Repeat.Once(); mockConnection.Close(); LastCall.On(mockConnection).Repeat.Once(); mocks.ReplayAll(); template.Execute(session => { bool b = session.Transacted; return null; }); mocks.VerifyAll(); }
0
7. Example
Project: spring-net
Source File: NmsTransactionManager.cs
Source File: NmsTransactionManager.cs
protected override void DoBegin(object transaction, ITransactionDefinition definition) { /n ..... /n //View Source file for more details /n }
0
8. Example
Project: spring-net
Source File: SingleConnectionFactoryTests.cs
Source File: SingleConnectionFactoryTests.cs
[Test] public void UsingConnection() { IConnection connection = mocks.StrictMock<IConnection>(); connection.Start(); LastCall.On(connection).Repeat.Twice(); connection.PurgeTempDestinations(); LastCall.On( connection ).Repeat.Twice(); connection.Stop(); LastCall.On(connection).Repeat.Once(); connection.Close(); LastCall.On(connection).Repeat.Once(); mocks.ReplayAll(); SingleConnectionFactory scf = new SingleConnectionFactory(connection); IConnection con1 = scf.CreateConnection(); con1.Start(); con1.PurgeTempDestinations(); con1.Stop(); // should be ignored con1.Close(); // should be ignored IConnection con2 = scf.CreateConnection(); con2.Start(); con1.PurgeTempDestinations(); con2.Stop(); // should be ignored con2.Close(); // should be ignored. scf.Dispose(); mocks.VerifyAll(); }
0
9. Example
Project: spring-net
Source File: SingleConnectionFactoryTests.cs
Source File: SingleConnectionFactoryTests.cs
[Test] public void UsingConnectionFactory() { IConnectionFactory connectionFactory = (IConnectionFactory)mocks.StrictMock<IConnectionFactory>(); IConnection connection = mocks.StrictMock<IConnection>(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once(); connection.Start(); LastCall.On(connection).Repeat.Twice(); connection.Stop(); LastCall.On(connection).Repeat.Once(); connection.Close(); LastCall.On(connection).Repeat.Once(); mocks.ReplayAll(); SingleConnectionFactory scf = new SingleConnectionFactory(connectionFactory); IConnection con1 = scf.CreateConnection(); con1.Start(); con1.Close(); // should be ignored IConnection con2 = scf.CreateConnection(); con2.Start(); con2.Close(); //should be ignored scf.Dispose(); //should trigger actual close mocks.VerifyAll(); }
0
10. Example
Project: spring-net
Source File: SingleConnectionFactoryTests.cs
Source File: SingleConnectionFactoryTests.cs
[Test] public void UsingConnectionFactoryAndClientId() { IConnectionFactory connectionFactory = mocks.StrictMock<IConnectionFactory>(); IConnection connection = mocks.StrictMock<IConnection>(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once(); connection.ClientId = "MyId"; LastCall.On(connection).Repeat.Once(); connection.Start(); LastCall.On(connection).Repeat.Twice(); connection.Stop(); LastCall.On(connection).Repeat.Once(); connection.Close(); LastCall.On(connection).Repeat.Once(); mocks.ReplayAll(); SingleConnectionFactory scf = new SingleConnectionFactory(connectionFactory); scf.ClientId = "MyId"; IConnection con1 = scf.CreateConnection(); con1.Start(); con1.Close(); // should be ignored IConnection con2 = scf.CreateConnection(); con2.Start(); con2.Close(); // should be ignored scf.Dispose(); // should trigger actual close mocks.VerifyAll(); }
0
11. Example
Project: spring-net
Source File: SingleConnectionFactoryTests.cs
Source File: SingleConnectionFactoryTests.cs
[Test] public void UsingConnectionFactoryAndExceptionListener() { IConnectionFactory connectionFactory = mocks.StrictMock<IConnectionFactory>(); IConnection connection = mocks.StrictMock<IConnection>(); IExceptionListener listener = new ChainedExceptionListener(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once(); connection.ExceptionListener += listener.OnException; LastCall.On(connection).IgnoreArguments(); connection.Start(); LastCall.On(connection).Repeat.Twice(); connection.Stop(); LastCall.On(connection).Repeat.Once(); connection.Close(); LastCall.On(connection).Repeat.Once(); mocks.ReplayAll(); SingleConnectionFactory scf = new SingleConnectionFactory(connectionFactory); scf.ExceptionListener = listener; IConnection con1 = scf.CreateConnection(); //can't look at invocation list on event ...grrr. con1.Start(); con1.Stop(); // should be ignored con1.Close(); // should be ignored IConnection con2 = scf.CreateConnection(); con2.Start(); con2.Stop(); con2.Close(); scf.Dispose(); mocks.VerifyAll(); }
0
12. Example
Project: spring-net
Source File: MessageTransactionManagerTests.cs
Source File: MessageTransactionManagerTests.cs
[Test] public void SuspendedTransaction() { IConnectionFactory connectio/n ..... /n //View Source file for more details /n }
0
13. Example
Project: spring-net
Source File: MessageTransactionManagerTests.cs
Source File: MessageTransactionManagerTests.cs
[Test] public void TransactionSuspension() { IConnectionFactory connecti/n ..... /n //View Source file for more details /n }
0
14. Example
Project: spring-net
Source File: MessageTransactionManagerTests.cs
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(); }
0
15. Example
Project: spring-net
Source File: MessageTransactionManagerTests.cs
Source File: MessageTransactionManagerTests.cs
private static void SetupCommitExpectations(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.Commit(); LastCall.On(session).Repeat.Once(); session.Close(); LastCall.On(session).Repeat.Once(); connection.Close(); LastCall.On(connection).Repeat.Once(); }
0
16. Example
Project: spring-net
Source File: ConnectionFactoryUtils.cs
Source File: ConnectionFactoryUtils.cs
public static ISession DoGetTransactionalSession(Object resourceKey, ResourceFactory resourceFactory/n ..... /n //View Source file for more details /n }
0
17. Example
Project: spring-net
Source File: SingleConnectionFactoryTests.cs
Source File: SingleConnectionFactoryTests.cs
[Test] public void CachingConnectionFactory() { IConnectionFactory conne/n ..... /n //View Source file for more details /n }
0
18. Example
Project: spring-net
Source File: MessageTemplateTests.cs
Source File: MessageTemplateTests.cs
[Test] public void SessionCallbackWithinSynchronizedTransaction() { Sing/n ..... /n //View Source file for more details /n }