Class AbstractDispatcher
java.lang.Object
org.springframework.integration.dispatcher.AbstractDispatcher
- All Implemented Interfaces:
- MessageDispatcher
- Direct Known Subclasses:
- BroadcastingDispatcher,- PartitionedDispatcher,- UnicastingDispatcher
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 OrderedAwareCopyOnWriteArraySet for more detail.
- Author:
- Mark Fisher, Iwein Fuld, Oleg Zhurakousky, Gary Russell, Diego Belfer, Artem Bilan, Christian Tzolov
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaddHandler(MessageHandler handler) Add the handler to the internal Set.intReturn the current handler count.protected Set<MessageHandler> Returns an unmodifiableSetof this dispatcher's handlers.booleanremoveHandler(MessageHandler handler) Remove the handler from the internal handler Set.voidsetMaxSubscribers(int maxSubscribers) Set the maximum subscribers allowed by this dispatcher.toString()protected booleantryOptimizedDispatch(Message<?> message) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.dispatcher.MessageDispatcherdispatch
- 
Field Details- 
logger
 
- 
- 
Constructor Details- 
AbstractDispatcherpublic AbstractDispatcher()
 
- 
- 
Method Details- 
setMaxSubscriberspublic void setMaxSubscribers(int maxSubscribers) Set the maximum subscribers allowed by this dispatcher.- Parameters:
- maxSubscribers- The maximum number of subscribers allowed.
 
- 
getHandlersReturns an unmodifiableSetof this dispatcher's handlers. This is provided for access by subclasses.- Returns:
- The message handlers.
 
- 
addHandlerAdd the handler to the internal Set.- Specified by:
- addHandlerin interface- MessageDispatcher
- Parameters:
- handler- The handler to add.
- Returns:
- the result of Set.add(Object)
 
- 
removeHandlerRemove the handler from the internal handler Set.- Specified by:
- removeHandlerin interface- MessageDispatcher
- Parameters:
- handler- the handler.
- Returns:
- the result of Set.remove(Object)
 
- 
tryOptimizedDispatch
- 
toString
- 
getHandlerCountpublic int getHandlerCount()Description copied from interface:MessageDispatcherReturn the current handler count.- Specified by:
- getHandlerCountin interface- MessageDispatcher
- Returns:
- the handler count.
 
 
-