Allow a blocked thread to unwind if it's connection is getting terminated.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@599835 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-11-30 14:42:53 +00:00
parent 27dff3538c
commit d83969f6a8
2 changed files with 10 additions and 2 deletions

View File

@ -449,7 +449,11 @@ public class Queue extends BaseDestination implements Task {
final ConnectionContext context = producerExchange.getConnectionContext();
message.setRegionDestination(this);
if (store != null && message.isPersistent()) {
systemUsage.getStoreUsage().waitForSpace();
while (!systemUsage.getStoreUsage().waitForSpace(1000)) {
if (context.getStopping().get()) {
throw new IOException("Connection closed, send aborted.");
}
}
store.addMessage(context, message);
}
if (context.isInTransaction()) {

View File

@ -388,7 +388,11 @@ public class Topic extends BaseDestination implements Task{
message.setRegionDestination(this);
if (store != null && message.isPersistent() && !canOptimizeOutPersistence()) {
systemUsage.getStoreUsage().waitForSpace();
while (!systemUsage.getStoreUsage().waitForSpace(1000)) {
if (context.getStopping().get()) {
throw new IOException("Connection closed, send aborted.");
}
}
store.addMessage(context, message);
}