org.springframework.integration.dispatcher
Class AbstractDispatcher

java.lang.Object
  extended by org.springframework.integration.dispatcher.AbstractDispatcher
All Implemented Interfaces:
MessageDispatcher
Direct Known Subclasses:
BroadcastingDispatcher, UnicastingDispatcher

public abstract class AbstractDispatcher
extends java.lang.Object
implements MessageDispatcher

Base class for MessageDispatcher implementations.

The subclasses implement the actual dispatching strategy, but this base class manages the registration of MessageHandlers. Although the implemented dispatching strategies may invoke handles in different ways (e.g. round-robin vs. failover), this class does maintain the order of the underlying collection. See the OrderedAwareLinkedHashSet for more detail.


Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
AbstractDispatcher()
           
 
Method Summary
 boolean addHandler(MessageHandler handler)
          Add the handler to the internal Set.
 int getHandlerCount()
           
protected  java.util.List<MessageHandler> getHandlers()
          Returns a copied, unmodifiable List of this dispatcher's handlers.
 boolean removeHandler(MessageHandler handler)
          Remove the handler from the internal handler Set.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.dispatcher.MessageDispatcher
dispatch
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

AbstractDispatcher

public AbstractDispatcher()
Method Detail

getHandlers

protected java.util.List<MessageHandler> getHandlers()
Returns a copied, unmodifiable List of this dispatcher's handlers. This is provided for access by subclasses.


addHandler

public boolean addHandler(MessageHandler handler)
Add the handler to the internal Set.

Specified by:
addHandler in interface MessageDispatcher
Returns:
the result of Set.add(Object)

removeHandler

public boolean removeHandler(MessageHandler handler)
Remove the handler from the internal handler Set.

Specified by:
removeHandler in interface MessageDispatcher
Returns:
the result of Set.remove(Object)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getHandlerCount

public int getHandlerCount()
Returns:
The current number of handlers