You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2019/09/24 13:37:28 UTC

[activemq-nms-amqp] branch master updated: AMQNET-615: Do not lock on static field

This is an automated email from the ASF dual-hosted git repository.

michaelpearce pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git


The following commit(s) were added to refs/heads/master by this push:
     new 9aa690b  AMQNET-615: Do not lock on static field
     new b804eaa  Merge pull request #37 from HavretGC/do_not_take_lock_on_static_field
9aa690b is described below

commit 9aa690bcc3bfa1fc4f1d3bab3de790174cb72c5d
Author: Havret <h4...@gmail.com>
AuthorDate: Mon Sep 23 17:17:31 2019 +0200

    AMQNET-615: Do not lock on static field
---
 src/NMS.AMQP/NmsMessageConsumer.cs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/NMS.AMQP/NmsMessageConsumer.cs b/src/NMS.AMQP/NmsMessageConsumer.cs
index a8c65d5..e84f458 100644
--- a/src/NMS.AMQP/NmsMessageConsumer.cs
+++ b/src/NMS.AMQP/NmsMessageConsumer.cs
@@ -27,7 +27,7 @@ namespace Apache.NMS.AMQP
 {
     public class NmsMessageConsumer : IMessageConsumer
     {
-        private static readonly object SyncRoot = new object();
+        private readonly object syncRoot = new object();
         private readonly AcknowledgementMode acknowledgementMode;
         private readonly AtomicBool closed = new AtomicBool();
         private readonly MessageDeliveryTask deliveryTask;
@@ -92,7 +92,7 @@ namespace Apache.NMS.AMQP
             if (closed)
                 return;
 
-            lock (SyncRoot)
+            lock (syncRoot)
             {
                 Shutdown(null);
                 Session.Connection.DestroyResource(Info).ConfigureAwait(false).GetAwaiter().GetResult();
@@ -106,7 +106,7 @@ namespace Apache.NMS.AMQP
             add
             {
                 CheckClosed();
-                lock (SyncRoot)
+                lock (syncRoot)
                 {
                     Listener += value;
                     DrainMessageQueueToListener();
@@ -114,7 +114,7 @@ namespace Apache.NMS.AMQP
             }
             remove
             {
-                lock (SyncRoot)
+                lock (syncRoot)
                 {
                     Listener -= value;
                 }
@@ -217,7 +217,7 @@ namespace Apache.NMS.AMQP
         {
             if (Session.IsStarted && started && Listener != null)
             {
-                lock (SyncRoot)
+                lock (syncRoot)
                 {
                     try
                     {
@@ -463,7 +463,7 @@ namespace Apache.NMS.AMQP
 
         public void Stop()
         {
-            lock (SyncRoot)
+            lock (syncRoot)
             {
                 started.Set(false);
             }