I have fix this bug and have included a patch for it. Could one of the
JBOSS MQ guys look at it and please apply. Basically if the message
selector says that the message should not be delivered, it expires the
message. That way the message is still acknowledged and is cleaned up.
--- BasicQueue.java Mon Apr 8 16:25:11 2002
+++ BasicQueue.java.new Mon Apr 8 16:23:26 2002
@@ -157,27 +157,21 @@
MessageReference messageRef = null;
synchronized (receivers) {
// If the subscription is not picky, the first message will be it
- if (sub.getSelector() == null && sub.noLocal==false ) {
synchronized (messages) {
- if (messages.size() != 0) {
+ if (messages.size() != 0)
+ {
messageRef = (MessageReference)messages.first();
messages.remove(messageRef);
- }
+ /*
+ If there is a selector and it is false then just expire
+ the message. This way it will get cleaned up.
+ */
+ if (sub.getSelector() != null &&
+!sub.accepts(messageRef.getHeaders()))
+ {
+
+messageRef.getMessage().header.jmsExpiration=System.currentTimeMillis()-10;
+ }
+ }
}
- } else {
- // The subscription is picky, so we have to iterate.
- synchronized (messages) {
- Iterator i = messages.iterator();
- while (i.hasNext()) {
- MessageReference mr = (MessageReference) i.next();
- if (sub.accepts(mr.getHeaders())) {
- messageRef = mr;
- i.remove();
- break;
- }
- }
- }
- }
if (messageRef == null) {
if (wait) {