org.jboss.messaging.core.plugin.postoffice.cluster
Class RoundRobinRouter

java.lang.Object
  extended byorg.jboss.messaging.core.plugin.postoffice.cluster.RoundRobinRouter
All Implemented Interfaces:
ClusterRouter, Distributor, Receiver, Router

public class RoundRobinRouter
extends java.lang.Object
implements ClusterRouter

This router first favours the failed over queue (if there is one) TODO revisit this Then it will round robin between the non queues. FIXME - none of the new failed over functionality has been tested!!

Version:
$Revision: 2319 $ $Id: DefaultRouter.java 2319 2007-02-15 07:16:11Z ovidiu.feodorov@jboss.com $
Author:
Tim Fox, Ovidiu Feodorov

Constructor Summary
RoundRobinRouter()
           
 
Method Summary
 boolean add(Receiver receiver)
          Add a local receiver to this distributor.
 boolean add(Receiver receiver, boolean failedOver)
           
 void clear()
          Remove all receivers.
 boolean contains(Receiver queue)
           
 Queue getLocalQueue()
           
 int getNumberOfReceivers()
           
 java.util.List getQueues()
           
 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 queue)
          Remove a local receiver from this distributor.
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoundRobinRouter

public RoundRobinRouter()
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

contains

public boolean contains(Receiver queue)
Specified by:
contains in interface Distributor

iterator

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

add

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

Specified by:
add in interface ClusterRouter

remove

public boolean remove(Receiver queue)
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

getNumberOfReceivers

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

getQueues

public java.util.List getQueues()
Specified by:
getQueues in interface ClusterRouter

add

public boolean add(Receiver receiver,
                   boolean failedOver)

getLocalQueue

public Queue getLocalQueue()
Specified by:
getLocalQueue in interface ClusterRouter

size

public int size()

toString

public java.lang.String toString()


Copyright © 2006 JBoss Inc. All Rights Reserved.