User: norbert 
  Date: 00/05/17 17:16:11

  Modified:    src/java/org/spyderMQ JMSServer.java JMSServerQueue.java
  Log:
  Fix some failure-handling stuff
  
  Revision  Changes    Path
  1.28      +10 -15    spyderMQ/src/java/org/spyderMQ/JMSServer.java
  
  Index: JMSServer.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/JMSServer.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- JMSServer.java    2000/05/17 23:43:08     1.27
  +++ JMSServer.java    2000/05/18 00:16:09     1.28
  @@ -20,7 +20,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.27 $
  + *   @version $Revision: 1.28 $
    */
   public class JMSServer 
                implements Runnable 
  @@ -122,8 +122,6 @@
                        //Notify that it has finished his work : now, another thread 
can start working on this destination
                        queue.endWork();
                        
  -                     Log.log("Job done !");
  -                     
                }
                        
        }
  @@ -268,7 +266,7 @@
        }
   
        //A connection is closing [error or notification]
  -     public synchronized void connectionClosing(SpyDistributedConnection dc)
  +     public synchronized void connectionClosing(SpyDistributedConnection 
dc,JMSServerQueue noCheck)
        {
                if (dc==null) return;
                
  @@ -279,29 +277,26 @@
                //Remove the connection from the subscribers list
                synchronized (messageQueue) {
   
  -                     HashMap newMap=(HashMap)messageQueue.clone();   
  +                     HashMap newMap=null;
                        Iterator i=messageQueue.values().iterator();
  +                     boolean modified=false; //we don't want to waste our memory :)
        
                        while (i.hasNext()) {
                                
                                JMSServerQueue sq=(JMSServerQueue)i.next();
  -                             
  +                                                             
                                if (dc.equals(sq.temporaryDestination)) {
  +                                     if (!modified) 
newMap=(HashMap)messageQueue.clone();
                                        newMap.remove(sq.destination);
  +                                     modified=true;
                                } else {
  -                                     Iterator i2=sq.subscribers.iterator();
  -                                     while (i2.hasNext()) {
  -                                             SpyDistributedConnection 
dc2=(SpyDistributedConnection)i2.next();
  -                                             if (dc.equals(dc2)) {
  -                                                     Log.log("FIXME: The 
DistributedConnection is registered !");
  -                                                     //Remove it !!!!!
  -                                             }
  -                                     }
  +                                     if (sq==noCheck) continue;
  +                                     sq.connectionClosing(dc);
                                }
                                
                        }
                
  -                     messageQueue=newMap;
  +                     if (modified) messageQueue=newMap;
                }
                
        }
  
  
  
  1.25      +11 -3     spyderMQ/src/java/org/spyderMQ/JMSServerQueue.java
  
  Index: JMSServerQueue.java
  ===================================================================
  RCS file: /products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/JMSServerQueue.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- JMSServerQueue.java       2000/05/16 18:04:58     1.24
  +++ JMSServerQueue.java       2000/05/18 00:16:10     1.25
  @@ -18,7 +18,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.24 $
  + *   @version $Revision: 1.25 $
    */
   public class JMSServerQueue
   {
  @@ -168,6 +168,14 @@
                }
        }
        
  +     //A connection is closing !
  +     void connectionClosing(SpyDistributedConnection dc)
  +     {
  +             if (!subscribers.contains(dc)) return;
  +             Log.log("Warning: The DistributedConnection was still registered for 
"+destination);
  +             removeSubscriber(dc);
  +     }
  +     
        void notifyWorkers()
        {
                //It is useless to put many times the same destination in the task 
queue
  @@ -185,8 +193,8 @@
                //We should try again :) Such behavior should under control of a 
Failure-Plugin         
                Log.error("I remove this Connection from the subscribers list");
                
  -             //Call JMSServer.ConnectionClosing()
  -             server.connectionClosing(dc);
  +             //Call JMSServer.ConnectionClosing(), but ask him not to check my list.
  +             server.connectionClosing(dc,this);
                
                //remove this connection from the list
                i.remove();
  
  
  

Reply via email to