User: norbert
Date: 00/05/31 19:47:49
Modified: src/java/org/spydermq/distributed/server
ConnectionReceiverRMIImpl.java
Log:
P2P : Fixes
Revision Changes Path
1.4 +33 -27
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ConnectionReceiverRMIImpl.java 2000/06/01 02:38:49 1.3
+++ ConnectionReceiverRMIImpl.java 2000/06/01 02:47:49 1.4
@@ -29,7 +29,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class ConnectionReceiverRMIImpl extends UnicastRemoteObject implements
ConnectionReceiverRMI
{
@@ -87,36 +87,42 @@
} else {
- SessionQueue sq=null;
+ while (true) {
+
+ SessionQueue sq=null;
- try {
+ try {
- //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 !");
+ //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;
+ 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 {
+ sq.dispatchMessage(dest,mes);
+ } catch (NoReceiverException e) {
+ //Unregister this session !
}
- 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);
-
+
+ }
}
}