User: pkendall
Date: 01/07/30 14:58:46
Modified: src/main/org/jbossmq Subscription.java
Log:
bug fixes for JVM addSubscription (need to clone the Subscription)
Revision Changes Path
1.6 +28 -16 jbossmq/src/main/org/jbossmq/Subscription.java
Index: Subscription.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/Subscription.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Subscription.java 2001/07/28 00:30:15 1.5
+++ Subscription.java 2001/07/30 21:58:46 1.6
@@ -15,10 +15,10 @@
/**
* This class contians all the data needed to for a the provider to
* to determine if a message can be routed to a consumer.
- *
+ *
* @author Hiram Chirino ([EMAIL PROTECTED])
- *
- * @version $Revision: 1.5 $
+ *
+ * @version $Revision: 1.6 $
*/
public class Subscription
implements Serializable
@@ -36,13 +36,13 @@
// Topics might not want locally produced messages
public boolean noLocal;
- // Transient Values
+ // Transient Values
public transient Selector selector;
public transient ConnectionToken dc;
public transient boolean listening;
public transient boolean receiving;
- // Determines the consumer would accept the message.
+ // Determines the consumer would accept the message.
public boolean accepts( SpyMessage message, boolean exclusive ) throws
javax.jms.JMSException {
Selector ms = getSelector();
@@ -59,39 +59,51 @@
// But if the subscriber is durable, then it acts like a Queue
if( actsLikeAQueue ) {
-
+
if( !exclusive )
return false;
if( !listening && !receiving )
return false;
-
+
}
-
+
} else {
-
+
if( !exclusive )
- return false;
+ return false;
// In the Queue case we only deliver if it is currently
// has a listner or is receiving
if( !listening && !receiving )
return false;
}
-
+
return true;
-
+
}
public boolean actsLikeAQueue;
- // Determines the consumer would accept the message.
+ // Determines the consumer would accept the message.
public Selector getSelector() throws javax.jms.JMSException {
if( messageSelector == null )
return null;
-
- if( selector==null )
+
+ if( selector==null )
selector = new Selector(messageSelector);
- return selector;
+ return selector;
}
+
+ public Subscription myClone(){
+ Subscription result = new Subscription();
+ //only need to clone non-transient fields for our purposes.
+ result.subscriptionId = subscriptionId;
+ result.destination = destination;
+ result.messageSelector = messageSelector;
+ result.destroyDurableSubscription = destroyDurableSubscription;
+ result.noLocal = noLocal;
+
+ return result;
+ }
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development