User: hiram   
  Date: 00/11/13 22:03:19

  Modified:    src/java/org/spydermq/distributed/server
                        ConnectionReceiverOIL.java
  Log:
  Fixed the p2p messaging deadlock
  
  Revision  Changes    Path
  1.7       +14 -8     
spyderMQ/src/java/org/spydermq/distributed/server/ConnectionReceiverOIL.java
  
  Index: ConnectionReceiverOIL.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/distributed/server/ConnectionReceiverOIL.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ConnectionReceiverOIL.java        2000/06/20 02:19:13     1.6
  +++ ConnectionReceiverOIL.java        2000/11/14 06:03:19     1.7
  @@ -40,7 +40,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.6 $
  + *   @version $Revision: 1.7 $
    */
   public class ConnectionReceiverOIL 
        implements Runnable, ConnectionReceiverSetup
  @@ -116,6 +116,7 @@
                                code=is.read();
                        } catch (IOException e) {
                                failure("Command read",e);
  +                             e.printStackTrace();
                                return;
                        }
                
  @@ -152,10 +153,14 @@
                                        return;                                 
                                }
                                
  -                     } catch (Exception e) {
  +                             } catch (Exception e) {
   
                                try {
  -                                     os.write(1);
  +                                     if( e instanceof NoReceiverException ) {
  +                                             os.write(2);
  +                                     } else {
  +                                             os.write(1);
  +                                     }
                                        out.writeObject(e.getMessage());
                                        out.flush();
                                        os.flush();
  @@ -230,7 +235,6 @@
                                //There is work to do... 
                                session.mutex.notifyLock();
                        }
  -                     
                } else {
                        
                        while (true) {
  @@ -247,7 +251,7 @@
                                        synchronized (connectionQueue) {
                                                
                                                //Find a SessionQueue
  -                                             if 
(connectionQueue.NumListeningSessions==0) throw new Exception("There are no listening 
sessions for this destination !");
  +                                             if 
(connectionQueue.NumListeningSessions==0) throw new NoReceiverException("There are no 
listening sessions for this destination !");
                        
                                                Iterator 
i=connectionQueue.subscribers.iterator();
                                                while (i.hasNext()) {
  @@ -257,10 +261,11 @@
                                                }
                                                if 
(sq==null||sq.NumListeningSubscribers==0) {
                                                        Log.error("FIXME: The 
listeners count was invalid !");
  -                                                     throw new Exception("There are 
no listening sessions for this destination !");
  +                                                     throw new 
NoReceiverException("There are no listening sessions for this destination !");
                                                }
                                        
                                                //Try with this sessionQueue
  +                                             Log.log("Dispatching to SessionQueue: 
"+mes);
                                                sq.dispatchMessage(dest,mes);
                                
                                                //Our work is done here
  @@ -269,16 +274,17 @@
   
                                } catch (NoReceiverException e) {
                                        //This SessionQueue should not have been 
registered !
  -                                     continue;
  +                                     throw e;
                                } catch (Exception e) {
                                        //This error is non-recoverable : we must 
unregister from this queue
                                        //Let the JMSServerQueue do its work
                                        Log.log(e);
  -                                     throw new NoReceiverException("There are no 
listening sessions in this connection");
  +                                     throw new JMSException("There are no listening 
sessions in this connection");
                                }
                        }
                        
                }
  +                     
        } 
   
       public void receiveMultiple(SpyDestination dest,int nb,ObjectInputStream in) 
throws Exception
  
  
  

Reply via email to