[AMQ-6849] - fix sendFailIfNoSpaceAfterTimeout policy entry default value

This commit is contained in:
gtully 2017-10-26 11:36:03 +01:00
parent 6da08b245e
commit 8e576be1d9
3 changed files with 11 additions and 8 deletions

View File

@ -206,7 +206,7 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
if (messagesWaitingForSpace.remove(timeout.message.getMessageId()) != null) {
ExceptionResponse response = new ExceptionResponse(
new ResourceAllocationException(
"Usage Manager Memory Limit reached. Stopping producer ("
"Usage Manager Memory Limit Wait Timeout. Stopping producer ("
+ timeout.message.getProducerId()
+ ") to prevent flooding "
+ getActiveMQDestination().getQualifiedName()

View File

@ -314,7 +314,7 @@ public class PolicyEntry extends DestinationMapEntry {
if (sendFailIfNoSpace != -1) {
destination.getSystemUsage().setSendFailIfNoSpace(isSendFailIfNoSpace());
}
if (sendFailIfNoSpaceAfterTimeout != 0) {
if (sendFailIfNoSpaceAfterTimeout != -1) {
destination.getSystemUsage().setSendFailIfNoSpaceAfterTimeout(getSendFailIfNoSpaceAfterTimeout());
}
}

View File

@ -66,6 +66,8 @@ public class DuplicateFromStoreTest {
public static CountDownLatch consumersFinished = new CountDownLatch(NUM_CONSUMERS );
public AtomicInteger totalMessagesToSend = new AtomicInteger(NUM_MSGS);
public AtomicInteger totalMessagesSent = new AtomicInteger(NUM_MSGS);
public AtomicInteger totalReceived = new AtomicInteger(0);
public int messageSize = 16*1000;
@ -92,7 +94,7 @@ public class DuplicateFromStoreTest {
// configure <systemUsage>
MemoryUsage memoryUsage = new MemoryUsage();
memoryUsage.setPercentOfJvmHeap(70);
memoryUsage.setPercentOfJvmHeap(50);
StoreUsage storeUsage = new StoreUsage();
storeUsage.setLimit(8 * 1024 * 1024 * 1024); // 8 gb
@ -133,7 +135,7 @@ public class DuplicateFromStoreTest {
LOG.info("All producers and consumers got started. Awaiting their termination");
producersFinished.await(100, TimeUnit.MINUTES);
LOG.info("All producers have terminated.");
LOG.info("All producers have terminated. remaining to send: " + totalMessagesToSend.get() + ", sent:" + totalMessagesSent.get());
consumersFinished.await(100, TimeUnit.MINUTES);
LOG.info("All consumers have terminated.");
@ -232,6 +234,7 @@ public class DuplicateFromStoreTest {
// send message
while (totalMessagesToSend.decrementAndGet() >= 0) {
producer.send(message);
totalMessagesSent.incrementAndGet();
log.debug("Sent message: " + counter);
counter++;
@ -241,7 +244,7 @@ public class DuplicateFromStoreTest {
Thread.sleep(PRODUCER_SLEEP);
}
} catch (Exception ex) {
log.error(ex.getMessage());
log.error(ex.toString());
return;
} finally {
try {
@ -313,10 +316,10 @@ public class DuplicateFromStoreTest {
TextMessage textMessage = (TextMessage) message2;
String text = textMessage.getText();
log.debug("Received: " + text.substring(0, 50));
} else if (totalReceived.get() < NUM_MSGS) {
log.error("Received message of unsupported type. Expecting TextMessage. count: " + totalReceived.get());
} else {
if (totalReceived.get() < NUM_MSGS) {
log.error("Received message of unsupported type. Expecting TextMessage. " + message2);
}
// all done
break;
}
if (message2 != null) {