simple code cleanup

This commit is contained in:
markpollack
2008-07-16 18:15:40 +00:00
parent 14d7f869b2
commit 5fbfcb0795
5 changed files with 39 additions and 17 deletions

View File

@@ -164,28 +164,20 @@ namespace Spring.Messaging.Nms.IConnections
//return (ISession)CollectionUtils.FindValueOfType(sessions, sessionType);
}
/// <summary>
/// Commits all sessions.
/// </summary>
public virtual void CommitAll()
{
foreach (ISession session in sessions)
{
session.Commit();
// TODO are these exceptions valid?
// try
// {
// session.Commit();
// }
// catch (TransactionInProgressException ex)
// {
// // Ignore -> can only happen in case of a distributed transaction.
// }
// catch (IllegalStateException ex)
// {
// // Ignore -> can only happen in case of a distributed transaction.
// }
}
}
/// <summary>
/// Closes all sessions then stops and closes all connections, in that order.
/// </summary>
public virtual void CloseAll()
{
foreach (ISession session in sessions)

View File

@@ -372,11 +372,27 @@ namespace Spring.Messaging.Nms.Listener
}
}
/// <summary>
/// Invoke the specified listener as standard JMS MessageListener.
/// </summary>
/// <remarks>Default implementation performs a plain invocation of the
/// <code>OnMessage</code> methods</remarks>
/// <param name="listener">The listener to invoke.</param>
/// <param name="message">The received message.</param>
/// <exception cref="NMSException">if thronw by the underlying NMS APIs</exception>
protected virtual void DoInvokeListener(IMessageListener listener, IMessage message)
{
listener.OnMessage(message);
}
/// <summary>
/// Invoke the specified listener as Spring SessionAwareMessageListener,
/// exposing a new NMS Session (potentially with its own transaction)
/// to the listener if demanded.
/// </summary>
/// <param name="listener">The Spring ISessionAwareMessageListener to invoke.</param>
/// <param name="session">The session to operate on.</param>
/// <param name="message">The received message.</param>
protected virtual void DoInvokeListener(ISessionAwareMessageListener listener, ISession session, IMessage message)
{
IConnection conToClose = null;

View File

@@ -62,6 +62,10 @@ namespace Spring.Messaging.Nms.Listener
return consumer;
}
/// <summary>
/// Close the message consumers and sessions.
/// </summary>
/// <throws>NMSException if destruction failed </throws>
protected override void DestroyListener()
{
logger.Debug("Closing NMS IMessageConsumers");
@@ -76,6 +80,9 @@ namespace Spring.Messaging.Nms.Listener
}
}
/// <summary>
/// Afters the properties set.
/// </summary>
public override void AfterPropertiesSet()
{
if (this.concurrentConsumers <= 0)

View File

@@ -87,9 +87,9 @@ namespace Spring.Messaging.Nms
/// <summary> Create a new NmsTemplate.</summary>
/// <remarks>
/// <p>Note: The IConnectionFactory has to be set before using the instance.
/// <para>Note: The IConnectionFactory has to be set before using the instance.
/// This constructor can be used to prepare a NmsTemplate via an ObjectFactory,
/// typically setting the IConnectionFactory.</p>
/// typically setting the IConnectionFactory.</para>
/// </remarks>
public NmsTemplate()
{

View File

@@ -95,6 +95,13 @@ namespace Spring.Messaging.Nms.Support.IDestinations
#endregion
/// <summary>
/// Resolves the given destination name to a NMS destination.
/// </summary>
/// <param name="session">The current session.</param>
/// <param name="destinationName">Name of the destination.</param>
/// <returns>The located IDestination</returns>
/// <exception cref="NMSException">If resolution failed.</exception>
public virtual IDestination ResolveDestinationName(ISession session, System.String destinationName)
{
return DestinationResolver.ResolveDestinationName(session, destinationName, PubSubDomain);