org.springframework.integration.dispatcher
Class AbstractDispatcher

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

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

Base class for MessageDispatcher implementations.

Author:
Mark Fisher

Field Summary
protected  org.apache.commons.logging.Log logger
           
protected  java.util.List<MessageTarget> targets
           
private  org.springframework.core.task.TaskExecutor taskExecutor
           
private  long timeout
           
 
Constructor Summary
AbstractDispatcher()
           
 
Method Summary
 boolean addTarget(MessageTarget target)
           
protected  org.springframework.core.task.TaskExecutor getTaskExecutor()
           
 boolean removeTarget(MessageTarget target)
           
protected  boolean sendMessageToTarget(Message<?> message, MessageTarget target)
           
 void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
          Specify a TaskExecutor for invoking the target endpoints.
 void setTimeout(long timeout)
          Specify the timeout for sending to a target (in milliseconds).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.dispatcher.MessageDispatcher
send
 

Field Detail

logger

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

targets

protected final java.util.List<MessageTarget> targets

timeout

private volatile long timeout

taskExecutor

private volatile org.springframework.core.task.TaskExecutor taskExecutor
Constructor Detail

AbstractDispatcher

public AbstractDispatcher()
Method Detail

setTimeout

public void setTimeout(long timeout)
Description copied from interface: MessageDispatcher
Specify the timeout for sending to a target (in milliseconds). Note that this value will only be applicable for blocking targets. The default value is 0.

Specified by:
setTimeout in interface MessageDispatcher

addTarget

public boolean addTarget(MessageTarget target)
Specified by:
addTarget in interface MessageDispatcher

removeTarget

public boolean removeTarget(MessageTarget target)
Specified by:
removeTarget in interface MessageDispatcher

setTaskExecutor

public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Specify a TaskExecutor for invoking the target endpoints. If none is provided, the invocation will occur in the thread that runs this polling dispatcher.


getTaskExecutor

protected org.springframework.core.task.TaskExecutor getTaskExecutor()

sendMessageToTarget

protected final boolean sendMessageToTarget(Message<?> message,
                                            MessageTarget target)