fixing intermittent lockdown on the testsuite

This commit is contained in:
Clebert Suconic 2016-01-07 13:58:01 -05:00
parent 9d80d548a5
commit 73b000b3c0
1 changed files with 12 additions and 18 deletions

View File

@ -559,15 +559,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
@Override
public void setStarted(final boolean started) {
synchronized (lock) {
// This is to make sure that the delivery process has finished any pending delivery
// otherwise a message may sneak in on the client while we are trying to stop the consumer
lockDelivery.writeLock().lock();
try {
this.started = browseOnly || started;
}
finally {
lockDelivery.writeLock().unlock();
}
this.started = browseOnly || started;
}
// Outside the lock
@ -579,17 +571,19 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
@Override
public void setTransferring(final boolean transferring) {
synchronized (lock) {
// This is to make sure that the delivery process has finished any pending delivery
// otherwise a message may sneak in on the client while we are trying to stop the consumer
lockDelivery.writeLock().lock();
try {
this.transferring = transferring;
}
finally {
lockDelivery.writeLock().unlock();
}
this.transferring = transferring;
}
// This is to make sure that the delivery process has finished any pending delivery
// otherwise a message may sneak in on the client while we are trying to stop the consumer
try {
lockDelivery.writeLock().lock();
}
finally {
lockDelivery.writeLock().unlock();
}
// Outside the lock
if (transferring) {
// And we must wait for any force delivery to be executed - this is executed async so we add a future to the