User: norbert 
  Date: 00/05/26 15:37:49

  Modified:    src/java/org/spyderMQ SpyConnection.java SpySession.java
                        SpyTopicPublisher.java
  Log:
  Fix for a 'notify' problem in SpySession.
  We have to work on the threading/notification issue (see bugzilla)
  
  Revision  Changes    Path
  1.31      +9 -8      spyderMQ/src/java/org/spyderMQ/SpyConnection.java
  
  Index: SpyConnection.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpyConnection.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- SpyConnection.java        2000/05/25 01:18:33     1.30
  +++ SpyConnection.java        2000/05/26 22:37:49     1.31
  @@ -29,7 +29,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.30 $
  + *   @version $Revision: 1.31 $
    */
   public class SpyConnection 
                implements Connection, Serializable
  @@ -76,20 +76,21 @@
   
        // Public --------------------------------------------------------
   
  -    public String getClientID() throws JMSException
  +     public String getClientID() throws JMSException
        {
                if (closed) throw new IllegalStateException("The connection is 
closed");
                return clientID;
        }
   
  -    public void setClientID(String cID) throws JMSException
  -     {
  -             if (closed) throw new IllegalStateException("The connection is 
closed");
  +
  +        public void setClientID(String cID) throws JMSException
  +        {
  +                if (closed) throw new IllegalStateException("The connection is 
closed");
                if (clientID!=null) throw new IllegalStateException("The connection 
has already a clientID");
   
                Log.log("SetClientID("+clientID+")");
   
  -             try {
  +             try {           
                        provider.checkID(cID);
                } catch (JMSException e) {
                        throw e;
  @@ -100,7 +101,7 @@
                clientID=cID;
        }
    
  -    public ConnectionMetaData getMetaData() throws JMSException
  +        public ConnectionMetaData getMetaData() throws JMSException
        {
                if (closed) throw new IllegalStateException("The connection is 
closed");                
                
  @@ -123,7 +124,7 @@
                exceptionListener=listener;
        }
   
  -    public void start() throws JMSException
  +        public void start() throws JMSException
        {
                if (closed) throw new IllegalStateException("The connection is 
closed");
                if (distributedConnection==null) createReceiver();
  
  
  
  1.20      +21 -20    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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SpySession.java   2000/05/26 05:38:22     1.19
  +++ SpySession.java   2000/05/26 22:37:49     1.20
  @@ -28,14 +28,14 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.19 $
  + *   @version $Revision: 1.20 $
    */
   public class SpySession 
        implements Runnable, Session
  -{
  -
  +{    
  +     
        // Attributes ----------------------------------------------------
  -
  +     
        //Is this session transacted ?
        protected boolean transacted;
        //What is the type of acknowledgement ?
  @@ -56,11 +56,11 @@
        boolean closed;
        //This object is the object used to synchronize the session's thread
        public Integer thread;
  +
  +     // Constructor ---------------------------------------------------             
    
   
  -     // Constructor ---------------------------------------------------
  -        
        SpySession(SpyConnection conn, boolean trans, int acknowledge, boolean stop)
  -     {
  +     { 
                connection=conn;
                transacted=trans;
                acknowledgeMode=acknowledge;
  @@ -71,7 +71,7 @@
                messageListener=null;
                closed=false;
                thread=new Integer(0);
  -                     
  +             
                //Start one thread for each session
                Thread oneThread=new Thread(this);
                oneThread.setDaemon(true);
  @@ -79,11 +79,11 @@
        }
   
        // Public --------------------------------------------------------
  -
  +     
        public BytesMessage createBytesMessage() throws JMSException
        {
                if (closed) throw new IllegalStateException("The session is closed");  
         
  -                                                                      
  +             
                return new SpyBytesMessage();
        } 
    
  @@ -111,7 +111,7 @@
        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;
  @@ -167,10 +167,9 @@
        {
                Log.log("Hi ! I'm a session thread :)");
                
  -             while (true) 
  -             {
  -                     synchronized (thread)
  -                     {
  +             while (true) {
  +
  +                     synchronized (thread) {
                                boolean doneJob=false;                          
                                
                                if (closed) return;
  @@ -196,6 +195,9 @@
                                }
                                
                                if (outgoingJob!=null) {
  +                                 //NL We should try (when it is possible) to send 
grouped messages to the server
  +                                 //NL Wait until we have a local optimisation
  +
                                        try {
                                                if (!outgoingJob.isOutdated()) 
                                                        
connection.sendToServer(outgoingJob);
  @@ -220,13 +222,13 @@
                                }
                                        
                                //If there was smthg to do, try again
  -                             if (doneJob&&!modeStop) continue;
  +                             if (doneJob) continue;
                                        
                                try {
                                        Log.log("SessionThread: I'm going to bed...");
                                        thread.wait();
                                        Log.log("SessionThread: I wake up");
  -                             } catch (InterruptedException e) {
  +                             } catch (InterruptedException e) {                     
                
                                }
   
                        }
  @@ -239,8 +241,7 @@
                closed=true;
   
                //if the thread is sleeping, kill it
  -             synchronized (thread)
  -             {
  +             synchronized (thread) {
                        thread.notify();
                }
                
  @@ -428,7 +429,7 @@
        //The connection has changed its mode (stop() or start())
        //We have to wait until message delivery has stopped or wake up the thread
        void notifyStopMode(boolean newValue)
  -     {
  +        {
                
                if (closed) throw new IllegalStateException("The session is closed");  
                                                                  
                if (modeStop==newValue) return; 
  
  
  
  1.10      +5 -3      spyderMQ/src/java/org/spyderMQ/SpyTopicPublisher.java
  
  Index: SpyTopicPublisher.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/SpyTopicPublisher.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SpyTopicPublisher.java    2000/05/26 05:38:22     1.9
  +++ SpyTopicPublisher.java    2000/05/26 22:37:49     1.10
  @@ -18,7 +18,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.9 $
  + *   @version $Revision: 1.10 $
    */
   public class SpyTopicPublisher 
        extends SpyMessageProducer 
  @@ -89,8 +89,10 @@
                message.setReadOnlyMode();
                
                //This message is not redelivered
  -             message.setJMSRedelivered(false);
  -             
  +             message.setJMSRedelivered(false);               
  +
  +             Log.log("publish");
  +
                //We must put a 'new message' in the Session's outgoing queue [3.9]    
                         
                mySession.sendMessage(message.myClone());
        }
  
  
  

Reply via email to