[
https://issues.apache.org/jira/browse/ARTEMIS-2212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16734837#comment-16734837
]
ASF GitHub Bot commented on ARTEMIS-2212:
-----------------------------------------
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
> Avoid using CLQ on ServerConsumerImpl
> -------------------------------------
>
> Key: ARTEMIS-2212
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2212
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Affects Versions: 2.7.0
> Reporter: Francesco Nigro
> Assignee: Francesco Nigro
> Priority: Minor
>
> ServerConsumerImpl is using a ConcurrentLinkedQueue that can be avoided to be
> used considering that any accesses is guarded by a lock.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)