You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/07/27 17:42:32 UTC
svn commit: r560282 -
/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
Author: chirino
Date: Fri Jul 27 08:42:31 2007
New Revision: 560282
URL: http://svn.apache.org/viewvc?view=rev&rev=560282
Log:
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.
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java?view=diff&rev=560282&r1=560281&r2=560282
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java Fri Jul 27 08:42:31 2007
@@ -19,12 +19,10 @@
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 @@
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 @@
* @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){