User: norbert 
  Date: 00/05/30 20:52:42

  Modified:    src/java/org/spyderMQ/distributed/server
                        ConnectionReceiverRMIImpl.java
  Log:
  Fixes for P2P system
  
  Revision  Changes    Path
  1.13      +10 -8     
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ConnectionReceiverRMIImpl.java    2000/05/31 02:54:31     1.12
  +++ ConnectionReceiverRMIImpl.java    2000/05/31 03:52:42     1.13
  @@ -17,6 +17,7 @@
   import org.spydermq.SpyTopicConnection;
   import org.spydermq.SpyQueueSession;
   import org.spydermq.Log;
  +import org.spydermq.NoReceiverException;
   import java.rmi.RemoteException; 
   import java.rmi.server.UnicastRemoteObject;
   import java.util.Hashtable;
  @@ -28,7 +29,7 @@
    *      
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.12 $
  + *   @version $Revision: 1.13 $
    */
   public class ConnectionReceiverRMIImpl extends UnicastRemoteObject implements 
ConnectionReceiverRMI
   {
  @@ -57,7 +58,7 @@
        //A message has arrived for this Connection, We have to dispatch it to the 
sessions
       public void receive(Destination dest,SpyMessage mes) throws JMSException
        {
  -             if (closed) throw new IllegalStateException("The connection is 
closed");        
  +             if (closed) throw new IllegalStateException("The connection is 
closed");
                
                Log.log("ConnectionReceiver: 
Receive(Destination="+dest.toString()+",Mes="+mes.toString()+")");
                
  @@ -88,24 +89,25 @@
                        
                        //Find one session waiting for this Queue
   
  -                     ConnectionQueue 
connectionQueue=(ConnectionQueue)connection.destinations.get(dest);             
  -                     if (connectionQueue==null) throw new JMSException("There is no 
receiver for this queue !");      //We should catch this error in the JMSServerQueue 
object
  -                     if (connectionQueue.NumListeningSessions==0) throw new 
JMSException("There is no receiver for this queue !"); //We should catch this error in 
the JMSServerQueue object
  +                     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();
  -                     SpySession session=null;
                        SessionQueue sq=null;
                        while (i.hasNext()) {
  -                             session=(SpySession)i.next();
  +                             SpySession session=(SpySession)i.next();
                                sq=(SessionQueue)session.destinations.get(dest);
                                if (sq.NumListeningSubscribers!=0) break;
                        }
                        if (sq==null||sq.NumListeningSubscribers==0) {
                                connectionQueue.NumListeningSessions=0;
                                Log.error("WARNING: The listeners count was invalid 
!");
  -                             throw new JMSException("There is no receiver for this 
queue !"); //We should catch this error in the JMSServerQueue object
  +                             throw new NoReceiverException("There are no listening 
sessions for this destination !");
                        }
   
  +                     //try/catch NoReceiverException
                        sq.dispatchMessage(dest,mes);
                        
                }
  
  
  

Reply via email to