ARTEMIS-1051 using ServerSession's own lock

This commit is contained in:
Clebert Suconic 2017-03-20 21:56:07 -04:00
parent 8394fec104
commit e2b2e247d9
1 changed files with 93 additions and 99 deletions

View File

@ -182,8 +182,6 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
private Set<Closeable> closeables;
private final Object sendLock = new Object();
public ServerSessionImpl(final String name,
final String username,
final String password,
@ -1287,12 +1285,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
}
@Override
public RoutingStatus send(Transaction tx,
public synchronized RoutingStatus send(Transaction tx,
final Message message,
final boolean direct,
boolean noAutoCreateQueue) throws Exception {
synchronized (sendLock) {
// If the protocol doesn't support flow control, we have no choice other than fail the communication
if (!this.getRemotingConnection().isSupportsFlowControl() && pagingManager.isDiskFull()) {
ActiveMQIOErrorException exception = ActiveMQMessageBundle.BUNDLE.diskBeyondLimit();
@ -1342,7 +1339,6 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
}
return result;
}
}
@Override
@ -1615,13 +1611,12 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
}
@Override
public RoutingStatus doSend(final Transaction tx,
public synchronized RoutingStatus doSend(final Transaction tx,
final Message msg,
final SimpleString originalAddress,
final boolean direct,
final boolean noAutoCreateQueue) throws Exception {
synchronized (sendLock) {
RoutingStatus result = RoutingStatus.OK;
RoutingType routingType = msg.getRouteType();
@ -1672,7 +1667,6 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
}
return result;
}
}
@Override
public List<MessageReference> getInTXMessagesForConsumer(long consumerId) {