org.jboss.messaging.core.impl
Class ClusterRoundRobinDistributor

java.lang.Object
  extended by org.jboss.messaging.core.impl.ClusterRoundRobinDistributor
All Implemented Interfaces:
Distributor, Receiver

public class ClusterRoundRobinDistributor
extends java.lang.Object
implements Distributor

This distributor is used when distributing to consumers of clustered queues. It maintains two round robin distributors - one corresponding to the remote receivers and one corresponding to the local receivers The local receivers always take priority over the remote receivers

Version:
$Revision: 1 $ $Id: $
Author:
Tim Fox

Constructor Summary
ClusterRoundRobinDistributor(Distributor local, Distributor remote)
           
 
Method Summary
 boolean add(Receiver r)
          Add a local receiver to this distributor.
 void addLocal(Receiver r)
           
 void addRemote(Receiver r)
           
 void clear()
          Remove all receivers.
 boolean contains(Receiver r)
          Does the distributor already contain the specified Receiver?
 int getNumberOfReceivers()
           
 Delivery handle(DeliveryObserver observer, MessageReference ref, Transaction tx)
          A receiver can return an active, "done" or null delivery.
 java.util.Iterator iterator()
           
 boolean remove(Receiver r)
          Remove a local receiver from this distributor.
 boolean removeLocal(Receiver r)
           
 boolean removeRemote(Receiver r)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterRoundRobinDistributor

public ClusterRoundRobinDistributor(Distributor local,
                                    Distributor remote)
Method Detail

handle

public Delivery handle(DeliveryObserver observer,
                       MessageReference ref,
                       Transaction tx)
Description copied from interface: Receiver
A receiver can return an active, "done" or null delivery. The method returns null in case the receiver doesn't accept the message. The return value is unspecified when the message is submitted in the context of a transaction (tx not null).

Specified by:
handle in interface Receiver
Parameters:
observer - - the component the delivery should be acknowledged to.
See Also:
Delivery, DeliveryObserver

add

public boolean add(Receiver r)
Description copied from interface: Distributor
Add a local receiver to this distributor.

Specified by:
add in interface Distributor
Returns:
true if the distributor did not already contain the specified receiver and the receiver was added to the distributor, false otherwise.

remove

public boolean remove(Receiver r)
Description copied from interface: Distributor
Remove a local receiver from this distributor.

Specified by:
remove in interface Distributor
Returns:
true if this distributor contained the specified receiver.

clear

public void clear()
Description copied from interface: Distributor
Remove all receivers.

Specified by:
clear in interface Distributor

contains

public boolean contains(Receiver r)
Description copied from interface: Distributor
Does the distributor already contain the specified Receiver?

Specified by:
contains in interface Distributor
Returns:

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface Distributor
Returns:
an iterator of receivers

getNumberOfReceivers

public int getNumberOfReceivers()
Specified by:
getNumberOfReceivers in interface Distributor
Returns:
The number of receivers in the distributor

addLocal

public void addLocal(Receiver r)

removeLocal

public boolean removeLocal(Receiver r)

addRemote

public void addRemote(Receiver r)

removeRemote

public boolean removeRemote(Receiver r)


Copyright © 2006 JBoss Inc. All Rights Reserved.