fix for AMQ-1346.. moved handling the not full event into the queue's task runner to avoid deadlocks and the recursiveness of the pagIn call that was

causing the Illeagal state exception.



git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@560282 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-07-27 15:42:31 +00:00
parent 956fe93bd2
commit d56ebd842d
1 changed files with 10 additions and 13 deletions

View File

@ -19,12 +19,10 @@ package org.apache.activemq.broker.region;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.jms.InvalidSelectorException;
import javax.jms.JMSException;
@ -340,17 +338,10 @@ public class Queue implements Destination, Task {
private final LinkedList<Runnable> messagesWaitingForSpace = new LinkedList<Runnable>();
private final Runnable sendMessagesWaitingForSpaceTask = new Runnable() {
public void run() {
// We may need to do this in async thread since this is run for within a synchronization
// that the UsageManager is holding.
synchronized( messagesWaitingForSpace ) {
while( !usageManager.isFull() && !messagesWaitingForSpace.isEmpty()) {
Runnable op = messagesWaitingForSpace.removeFirst();
op.run();
}
}
try {
taskRunner.wakeup();
} catch (InterruptedException e) {
}
};
};
@ -928,6 +919,12 @@ public class Queue implements Destination, Task {
* @see org.apache.activemq.thread.Task#iterate()
*/
public boolean iterate(){
while( !usageManager.isFull() && !messagesWaitingForSpace.isEmpty()) {
Runnable op = messagesWaitingForSpace.removeFirst();
op.run();
}
try{
pageInMessages(false);
}catch(Exception e){