[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] activemq-artemis pull request #2119: Artemis 1902

Github user michaelandrepearce commented on a diff in the pull request:

    --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/QueueInfo.java ---
    @@ -107,7 +108,11 @@ public void incrementConsumers() {
        public void decrementConsumers() {
    -      numberOfConsumers--;
    +      if (numberOfConsumers > 0) {
    --- End diff --
    This isnt being atomically updated so still possible two decrements at the same time can cause the number to go negative incorrectly.
    To avoid this ideally should syncronize any update to the field or make changes to the field using an atomic updater