User: norbert 
  Date: 00/05/31 19:38:50

  Modified:    src/java/org/spydermq/distributed/server
                        ConnectionReceiverRMIImpl.java
  Log:
  P2P : Fixes
  
  Revision  Changes    Path
  1.3       +26 -17    
spyderMQ/src/java/org/spydermq/distributed/server/ConnectionReceiverRMIImpl.java
  
  Index: ConnectionReceiverRMIImpl.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/spyderMQ/src/java/org/spydermq/distributed/server/ConnectionReceiverRMIImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectionReceiverRMIImpl.java    2000/06/01 01:14:30     1.2
  +++ ConnectionReceiverRMIImpl.java    2000/06/01 02:38:49     1.3
  @@ -29,7 +29,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.2 $
  + *   @version $Revision: 1.3 $
    */
   public class ConnectionReceiverRMIImpl extends UnicastRemoteObject implements 
ConnectionReceiverRMI
   {
  @@ -87,27 +87,36 @@
                        
                } else {
                        
  -                     //Find one session waiting for this Queue
  +                     SessionQueue sq=null;
   
  -                     if (connection.modeStop) throw new NoReceiverException("This 
connection is stopped !");
  -                     ConnectionQueue 
connectionQueue=(ConnectionQueue)connection.destinations.get(dest);
  -                     if (connectionQueue==null) throw new 
NoReceiverException("There is no connectionQueue for this destination !");
  -                     if (connectionQueue.NumListeningSessions==0) throw new 
NoReceiverException("There are no listening sessions for this destination !");
  +                     try {
                        
  -                     Iterator i=connectionQueue.subscribers.iterator();
  -                     SessionQueue sq=null;
  -                     while (i.hasNext()) {
  -                             SpySession session=(SpySession)i.next();
  -                             sq=(SessionQueue)session.destinations.get(dest);
  -                             if (sq.NumListeningSubscribers!=0) break;
  -                     }
  -                     if (sq==null||sq.NumListeningSubscribers==0) {
  -                             Log.error("FIXME: The listeners count was invalid !");
  -                             throw new NoReceiverException("There are no listening 
sessions for this destination !");
  -                     }
  +                             //Find one session waiting for this Queue
  +                             if (connection.modeStop) throw new 
NoReceiverException("This connection is stopped !");
  +                             ConnectionQueue 
connectionQueue=(ConnectionQueue)connection.destinations.get(dest);
  +                             if (connectionQueue==null) throw new 
NoReceiverException("There is no connectionQueue 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()) {
  +                                     SpySession session=(SpySession)i.next();
  +                                     
sq=(SessionQueue)session.destinations.get(dest);
  +                                     if (sq.NumListeningSubscribers!=0) break;
  +                             }
  +                             if (sq==null||sq.NumListeningSubscribers==0) {
  +                                     Log.error("FIXME: The listeners count was 
invalid !");
  +                                     throw new NoReceiverException("There are no 
listening sessions for this destination !");
  +                             }
  +
  +                     } catch (Exception e) {
  +                             //This error is non-recoverable : we must unregister 
from this queue
  +                             Log.log(e);
  +                             throw new NoReceiverException("There are no listening 
sessions in this connection");
  +                     } 
   
                        //try/catch NoReceiverException, and find someone else in the 
same connection !
                        sq.dispatchMessage(dest,mes);
  +
                        
                }
        } 
  
  
  

Reply via email to