From ce9ee2d4d2b25f4ee3230d5c13c6332660d119e4 Mon Sep 17 00:00:00 2001 From: markpollack Date: Fri, 30 Oct 2009 20:59:45 +0000 Subject: [PATCH] SPRNET-1253 - NmsTemplate: wrong timeout units in receive method (ticks instead of milliseconds) --- .../Messaging/Nms/Core/NmsTemplate.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs index e138cf01..41444368 100644 --- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs +++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs @@ -55,13 +55,19 @@ namespace Spring.Messaging.Nms.Core #endregion + #region Fields /// /// Timeout value indicating that a receive operation should /// check if a message is immediately available without blocking. /// - public static readonly long DEFAULT_RECEIVE_TIMEOUT = -1; + public static readonly long RECEIVE_TIMEOUT_NO_WAIT = -1; + + /// + /// Timeout value indicating a blocking receive without timeout. + /// + public static readonly long RECEIVE_TIMEOUT_INDEFINITE_WAIT = 0; private NmsTemplateResourceFactory transactionalResourceFactory; @@ -76,7 +82,7 @@ namespace Spring.Messaging.Nms.Core private bool pubSubNoLocal = false; - private long receiveTimeout = DEFAULT_RECEIVE_TIMEOUT; + private long receiveTimeout = RECEIVE_TIMEOUT_NO_WAIT; private bool explicitQosEnabled = false; @@ -284,7 +290,7 @@ namespace Spring.Messaging.Nms.Core } /// - /// Gets or sets the receive timeout to use for recieve calls. + /// Gets or sets the receive timeout to use for recieve calls (in milliseconds) /// /// The default is -1, which means no timeout. /// The receive timeout. @@ -1064,9 +1070,9 @@ namespace Spring.Messaging.Nms.Core if (resourceHolder != null && resourceHolder.HasTimeout) { timeout = Convert.ToInt64(resourceHolder.TimeToLiveInMilliseconds); - } + } IMessage message = (timeout > 0) - ? consumer.Receive(new TimeSpan(timeout)) + ? consumer.Receive(TimeSpan.FromMilliseconds(timeout)) : consumer.Receive(); if (session.Transacted) {