Basically because of efficiency.
Because the possibility exists that when a receive is done the receiver may
already be in the list of receivers (due to receives with timeouts) we have
to check that a receiver is not already in the list before adding them to
the list. This search O(n) for a LinkedList and constant time for a
HashSet.
If you are absolutely desparate for the round-robin allocation of messages
then I would re-implement keeping both the LinkedList and the HashSet. Use
the HashSet to check if the receiver is already receiving and the LinkedList
to maintain the order of the requests.
The code I am talking about is the org.jboss.mq.server.BasicQueue class.
Cheers,
David.
> -----Original Message-----
> From: Jason Dillon [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 22, 2001 1:50 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-dev] jbossmq & load balancing across vms
>
>
> > What this means is that if you have multiple receivers
> waiting for a message
> > from a queue and a message arrives then it will be
> immediately delivered to
> > receiver A. Receiver A is now removed from the HashSet,
> however if receiver
> > A finishes its processing and requests another message
> before another
> > message is sent to the queue it will be added back to the
> HashSet. When the
> > next message arrives set will again be sent to receiver A
> because in the
> > HashSets ordering receiver A is clearly ahead of receiver B.
>
> Why a HashSet and not a LinkedList?
>
> --jason
>
>
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development
>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development