Github user franz1981 commented on the issue:

    https://github.com/apache/activemq-artemis/pull/2480
  
    @michaelandrepearce I'm taking another look and I'm not 100% sure to 
replace the usage of the lock object with `this` or synchronized methods, 
because I see that the synchronization on `this` has a different semantic and 
uses, separated from `lock` eg 
    ```java
    public HandleStatus handle(final MessageReference ref) throws Exception {
          // available credits can be set back to null with a flow control 
option.
          AtomicInteger checkInteger = availableCredits;
          if (callback != null && !callback.hasCredits(this) || checkInteger != 
null && checkInteger.get() <= 0) {
             if (logger.isDebugEnabled()) {
                logger.debug(this + " is busy for the lack of credits. Current 
credits = " +
                                availableCredits +
                                " Can't receive reference " +
                                ref);
             }
    
             return HandleStatus.BUSY;
          }
    
          synchronized (lock) {
    ```
    `handle` is not synchronized, while other methods are, but a part of it 
`synchronized (lock)`, making the behaviour different if I replace 
`synchronized (lock)` with a `synchronized (this)` ie the risk is to be blocked 
by other method calls that currently are not blocking it


---

Reply via email to