Skip to content

Commit

Permalink
Improved robustness of threading in MsmqTransport.
Browse files Browse the repository at this point in the history
  • Loading branch information
udidahan committed Jan 3, 2011
1 parent ec34bd5 commit bb022bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/impl/unicast/NServiceBus.Unicast.Msmq/MsmqTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,16 @@ private void ClearFailuresForMessage(string messageId)

private void IncrementFailuresForMessage(string messageId)
{
failuresPerMessageLocker.EnterWriteLock();
try
{
if (!failuresPerMessage.ContainsKey(messageId))
failuresPerMessageLocker.EnterWriteLock();

if (!failuresPerMessage.ContainsKey(messageId))
failuresPerMessage[messageId] = 1;
else
failuresPerMessage[messageId] = failuresPerMessage[messageId] + 1;
}
catch {} //intentionally swallow exceptions here
finally
{
failuresPerMessageLocker.ExitWriteLock();
Expand Down

0 comments on commit bb022bd

Please sign in to comment.