User: norbert
Date: 00/05/24 18:18:35
Modified: src/java/org/spyderMQ/distributed/server
ConnectionReceiverRMIImpl.java
Log:
More for P2P :
Create a new class ( ConnectionQueue ) which holds the subscribers HashSet
Revision Changes Path
1.10 +10 -10
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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ConnectionReceiverRMIImpl.java 2000/05/18 02:10:05 1.9
+++ ConnectionReceiverRMIImpl.java 2000/05/25 01:18:35 1.10
@@ -9,6 +9,7 @@
import javax.jms.Destination;
import javax.jms.JMSException;
import org.spydermq.SpyConnection;
+import org.spydermq.ConnectionQueue;
import org.spydermq.SpyMessage;
import org.spydermq.SpySession;
import org.spydermq.SpyDestination;
@@ -24,7 +25,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class ConnectionReceiverRMIImpl extends UnicastRemoteObject implements
ConnectionReceiverRMI
{
@@ -45,12 +46,12 @@
// Public --------------------------------------------------------
- public void setConnection(SpyConnection c)
+ public void setConnection(SpyConnection connection)
{
- connection=c;
+ this.connection=connection;
}
- //A message has arrived for this Connection, I has to dispatch it to his
clients (Session objects)
+ //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");
@@ -59,10 +60,10 @@
//Get the set of subscribers for this Destination
- HashSet set=(HashSet)connection.subscribers.get(dest);
- if (set==null||set.isEmpty()) return;
+ ConnectionQueue
connectionQueue=(ConnectionQueue)connection.destinations.get(dest);
+ if (connectionQueue==null) return;
- Iterator i=set.iterator();
+ Iterator i=connectionQueue.subscribers.iterator();
while (i.hasNext()) {
@@ -75,9 +76,8 @@
synchronized (session.thread) {
//We should not have to wait for the lock...
session.thread.notify();
- }
-
- }
+ }
+ }
}