[jboss-cvs] JBoss Messaging SVN: r5153 - in branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging: util/prioritylinkedlist and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 20 01:41:17 EDT 2008
Author: gaohoward
Date: 2008-10-20 01:41:17 -0400 (Mon, 20 Oct 2008)
New Revision: 5153
Modified:
branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/util/prioritylinkedlist/BasicPriorityLinkedList.java
branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/util/prioritylinkedlist/PriorityLinkedList.java
Log:
JBMESSAGING-1416
Modified: branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
===================================================================
--- branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/core/impl/ChannelSupport.java 2008-10-19 13:17:29 UTC (rev 5152)
+++ branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/core/impl/ChannelSupport.java 2008-10-20 05:41:17 UTC (rev 5153)
@@ -635,6 +635,7 @@
dlog("iter still null when inspecting this message ", ref);
iter = messageRefs.iterator();
//We just tried the first one, so we don't want to try it again
+ dlog("call next on iter to skip over the current one", ref);
iter.next();
}
}
@@ -932,11 +933,17 @@
// We need to extend it to work with refs from the db
//We have an iterator - this means we are iterating through the queue to find a ref that matches
- while (iter.hasNext())
+ log.error("---nextRef call, loop for next");
+ if (iter.hasNext())
{
+ log.error("---nextRef call, found one");
ref = (MessageReference)iter.next();
//if (monitor.challengeSend(ref) == OrderingGroupMonitor.OK) break;
}
+ else
+ {
+ ref = null;
+ }
}
return ref;
Modified: branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/util/prioritylinkedlist/BasicPriorityLinkedList.java
===================================================================
--- branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/util/prioritylinkedlist/BasicPriorityLinkedList.java 2008-10-19 13:17:29 UTC (rev 5152)
+++ branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/util/prioritylinkedlist/BasicPriorityLinkedList.java 2008-10-20 05:41:17 UTC (rev 5153)
@@ -29,6 +29,7 @@
import java.util.NoSuchElementException;
import javax.jms.JMSException;
+import javax.swing.event.ListSelectionEvent;
import org.jboss.jms.message.JBossMessage;
import org.jboss.jms.message.JBossTextMessage;
@@ -123,7 +124,6 @@
{
size--;
}
-
return obj;
}
@@ -271,11 +271,11 @@
return true;
}
while (index >= 0)
- {
+ {
if (index == 0 || currentIter.hasNext())
{
break;
- }
+ }
index--;
currentIter = lists[index].listIterator();
}
@@ -314,79 +314,14 @@
public void remove()
{
currentIter.remove();
-
size--;
}
-
+
public void set(Object obj)
{
throw new UnsupportedOperationException();
}
- /**
- * utility to avoid concurrent modification exception.
- */
- public byte downgrade(Object obj, byte oldPriority)
- {
-
- currentIter.remove();
-
- byte result = (byte)((oldPriority == 0) ? 0 : (oldPriority - 1));
-
- LinkedList list = lists[result];
-
- if (result == index)
- {
- //only if there are more elements.
- if (currentIter.hasNext())
- {
- int pidx = currentIter.previousIndex();
- list.add(obj);
-
- if (pidx != -1)
- {
- currentIter = list.listIterator(pidx);
- }
- else
- {
- //seems not possible.
- currentIter = list.listIterator();
- }
- }
- }
- else
- {
- //safe
- list.add(obj);
- }
- return result;
- }
}
-
- public byte downgrade(Object obj, byte oldPriority)
- {
- byte result = (byte)((oldPriority == 0) ? 0 : (oldPriority - 1));
-
- LinkedList list = linkedLists[oldPriority];
- Object first = list.removeFirst();
-
- for ( byte i = result; i >= 0; i--)
- {
- result = i;
- list = linkedLists[result];
- if (!list.isEmpty())
- {
- break;
- }
- }
- list.addLast(obj);
- return result;
- }
-
- public byte downgradeThruIter(Object obj, byte oldPriority, ListIterator iter)
- {
- PriorityLinkedListIterator iterator = (PriorityLinkedListIterator)iter;
- return iterator.downgrade(obj, oldPriority);
- }
}
Modified: branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/util/prioritylinkedlist/PriorityLinkedList.java
===================================================================
--- branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/util/prioritylinkedlist/PriorityLinkedList.java 2008-10-19 13:17:29 UTC (rev 5152)
+++ branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/util/prioritylinkedlist/PriorityLinkedList.java 2008-10-20 05:41:17 UTC (rev 5153)
@@ -61,15 +61,4 @@
void dump();
- /**
- * move the references to different priority list.
- * return the new priority.
- */
- byte downgrade(Object obj, byte oldPriority);
-
- /**
- * use the iterate to do the job to avoid concurrent exception.
- */
- byte downgradeThruIter(Object obj, byte oldPriority, ListIterator iter);
-
}
More information about the jboss-cvs-commits
mailing list