User: hiram   
  Date: 00/12/13 07:59:10

  Modified:    src/java/org/spydermq SpyMessage.java
                        SpyMessageConsumer.java SpySession.java
                        SpyTopicSubscriber.java
  Log:
  To fix the noLocal bug Peter Tillemans reported on the mailing list on 12/12
  
  Revision  Changes    Path
  1.9       +6 -15     spyderMQ/src/java/org/spydermq/SpyMessage.java
  
  Index: SpyMessage.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyMessage.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SpyMessage.java   2000/12/12 05:58:55     1.8
  +++ SpyMessage.java   2000/12/13 15:59:09     1.9
  @@ -23,7 +23,7 @@
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    *   @author Hiram Chirino ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.8 $
  + *   @version $Revision: 1.9 $
    */
   public class SpyMessage 
        implements Serializable, Cloneable, Message, Comparable
  @@ -35,13 +35,7 @@
        static final int DEFAULT_PRIORITY = -1;
        static final int DEFAULT_TIME_TO_LIVE = -1;
   
  -     // Attributes ----------------------------------------------------
  -
  -     public boolean persistent=false;
  -     public transient boolean removed=false;
  -     
        //Those attributes are not transient ---------------
  -     
        //Header fields 
        //Set by send() method
        public Destination jmsDestination=null;
  @@ -58,20 +52,18 @@
        private String jmsType=null;
        //Set by the provider
        private boolean jmsRedelivered=false;
  -     
        //Properties
        private Hashtable prop;
        private boolean propReadWrite;
  -     
        //Message body
        protected boolean msgReadOnly=false;
  +     //For noLocal to be able to tell if this was a locally produced message
  +     public String producerClientId;
        
  +     // Transient Attributes ------------------------------------------
        //For acknowledgment (set on the client side)
        private transient SpySession spySession;
  -
  -     //For the storage in the JMSServerQueue object
  -     public transient SpyDistributedConnection originalDistributedConnection;
  -     //For ordering in the JMSServerQueue
  +     //For ordering in the JMSServerQueue (set on the server side)
        public transient long messageId;
        
        // Constructor ---------------------------------------------------
  @@ -459,7 +451,7 @@
                        return 1;
                }
                return (int)(messageId - sm.messageId);         
  -     }    
  +     }     
   
        
        public void doAcknowledge() throws JMSException
  @@ -494,5 +486,4 @@
        public void setSpySession(SpySession newSpySession) {
                spySession = newSpySession;
        }
  -
   }
  
  
  
  1.5       +9 -1      spyderMQ/src/java/org/spydermq/SpyMessageConsumer.java
  
  Index: SpyMessageConsumer.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyMessageConsumer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SpyMessageConsumer.java   2000/11/19 19:59:57     1.4
  +++ SpyMessageConsumer.java   2000/12/13 15:59:09     1.5
  @@ -20,8 +20,9 @@
    *   This class implements javax.jms.MessageConsumer
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
  + *   @author Hiram Chirino ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.5 $
    */
   public class SpyMessageConsumer 
        implements MessageConsumer
  @@ -46,6 +47,8 @@
        public Destination destination; 
        //If the session is transacted: contains JMSMessageId's of messages consumed
        LinkedList messagesConsumed;    
  +     //Am I in noLocal mode ?
  +     boolean noLocal;
        
        // Constructor ---------------------------------------------------
           
  @@ -154,6 +157,11 @@
                                                } else {
                                                        Log.log("SessionQueue: 
selector evaluates TRUE");
                                                }
  +                                     }
  +                                     
  +                                     if (noLocal && 
mes.producerClientId.equals(session.connection.clientID)) {
  +                                             Log.notice("SessionQueue: I dropped a 
message (noLocal)");
  +                                             continue;
                                        }
                                                
                                        //the SAME Message object is put in different 
SessionQueues
  
  
  
  1.14      +27 -13    spyderMQ/src/java/org/spydermq/SpySession.java
  
  Index: SpySession.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpySession.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SpySession.java   2000/12/12 05:58:57     1.13
  +++ SpySession.java   2000/12/13 15:59:10     1.14
  @@ -31,7 +31,7 @@
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    *   @author Hiram Chirino ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.13 $
  + *   @version $Revision: 1.14 $
    */
   public class SpySession 
        implements Runnable, Session
  @@ -88,60 +88,74 @@
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
                
  -             return new SpyBytesMessage();
  +             SpyBytesMessage message = new SpyBytesMessage();
  +             message.producerClientId = connection.getClientID();
  +             return message;
        } 
    
        public MapMessage createMapMessage() throws JMSException
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
                                                                         
  -             return new SpyMapMessage();
  +             SpyMapMessage message = new SpyMapMessage();
  +             message.producerClientId = connection.getClientID();
  +             return message;
        }
   
        public Message createMessage() throws JMSException
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
                                                                         
  -             return new SpyMessage();
  +             SpyMessage message = new SpyMessage();
  +             message.producerClientId = connection.getClientID();
  +             return message;
        }
   
        public ObjectMessage createObjectMessage() throws JMSException
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
                                                                         
  -             return new SpyObjectMessage();
  +             SpyObjectMessage message = new SpyObjectMessage();
  +             message.producerClientId = connection.getClientID();
  +             return message;
        } 
   
        public ObjectMessage createObjectMessage(Serializable object) throws 
JMSException
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
                
  -             ObjectMessage msg=new SpyObjectMessage();
  -             msg.setObject(object);
  -             return msg;
  +             SpyObjectMessage message=new SpyObjectMessage();
  +             message.setObject(object);
  +             message.producerClientId = connection.getClientID();
  +             return message;
        }
   
        public StreamMessage createStreamMessage() throws JMSException
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
                                                                         
  -             return new SpyStreamMessage();
  +             SpyStreamMessage message = new SpyStreamMessage();
  +             message.producerClientId = connection.getClientID();
  +             return message;
        }
   
        public TextMessage createTextMessage() throws JMSException
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
                                                                         
  -             return new SpyTextMessage();
  +             SpyTextMessage message = new SpyTextMessage();
  +             message.producerClientId = connection.getClientID();
  +             return message;
        }
   
        public TextMessage createTextMessage(StringBuffer stringBuffer) throws 
JMSException
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
                                                                         
  -             TextMessage msg=new SpyTextMessage();
  -             msg.setText(stringBuffer.toString());
  -             return msg;
  +             SpyTextMessage message=new SpyTextMessage();
  +             message.setText(stringBuffer.toString());
  +             message.producerClientId = connection.getClientID();
  +             return message;
        }
   
        public boolean getTransacted() throws JMSException
  
  
  
  1.7       +6 -6      spyderMQ/src/java/org/spydermq/SpyTopicSubscriber.java
  
  Index: SpyTopicSubscriber.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/SpyTopicSubscriber.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SpyTopicSubscriber.java   2000/11/19 19:59:57     1.6
  +++ SpyTopicSubscriber.java   2000/12/13 15:59:10     1.7
  @@ -18,8 +18,9 @@
    *   This class implements javax.jms.TopicSubscriber
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
  + *   @author Hiram Chirino ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.6 $
  + *   @version $Revision: 1.7 $
    */
   public class SpyTopicSubscriber 
        extends SpyMessageConsumer 
  @@ -29,17 +30,16 @@
   
        //The topic I registered
        private Topic topic;
  -     //Am I in local mode ?
  -     boolean local;
   
  +
        // Constructor ---------------------------------------------------
           
  -     SpyTopicSubscriber(SpyTopicSession session,Topic topic,boolean local) 
  +     SpyTopicSubscriber(SpyTopicSession session,Topic topic,boolean noLocal) 
        {
                super(session);
                destination=topic;
                this.topic=topic;
  -             this.local=local;
  +             this.noLocal=noLocal;
        }
   
        // Public --------------------------------------------------------
  @@ -53,7 +53,7 @@
        public boolean getNoLocal() throws JMSException
        {
                if (closed) throw new IllegalStateException("The MessageConsumer is 
closed");                   
  -             return local;
  +             return noLocal;
        }
        
        //Overrides MessageConsumer
  
  
  

Reply via email to