org.springframework.integration.channel
Class ThreadLocalChannel
java.lang.Object
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.channel.ThreadLocalChannel
- All Implemented Interfaces:
- org.springframework.beans.factory.BeanNameAware, MessageChannel, BlockingSource, BlockingTarget, Source, Target
public class ThreadLocalChannel
- extends AbstractMessageChannel
A channel implementation that stores messages in a thread-bound queue. In
other words, send() will put a message at the tail of the queue for the
current thread, and receive() will retrieve a message from the head of the
queue.
- Author:
- Dave Syer, Mark Fisher
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel |
addInterceptor, getDispatcherPolicy, getName, receive, receive, send, send, setBeanName, setInterceptors, setName, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
messageHolder
private static final ThreadLocalChannel.ThreadLocalMessageHolder messageHolder
ThreadLocalChannel
public ThreadLocalChannel()
doReceive
protected Message<?> doReceive(long timeout)
- Description copied from class:
AbstractMessageChannel
- Subclasses must implement this method. A non-negative timeout indicates
how long to wait if the channel is empty (if the value is 0, it must
return immediately with or without success). A negative timeout value
indicates that the method should block until either a message is
available or the blocking thread is interrupted.
- Specified by:
doReceive
in class AbstractMessageChannel
doSend
protected boolean doSend(Message<?> message,
long timeout)
- Description copied from class:
AbstractMessageChannel
- Subclasses must implement this method. A non-negative timeout indicates
how long to wait if the channel is at capacity (if the value is 0, it
must return immediately with or without success). A negative timeout
value indicates that the method should block until either the message is
accepted or the blocking thread is interrupted.
- Specified by:
doSend
in class AbstractMessageChannel
clear
public java.util.List<Message<?>> clear()
- Remove and return any messages that are stored for the current thread.
purge
public java.util.List<Message<?>> purge(MessageSelector selector)
- Remove and return any messages that are stored for the current thread
and do not match the provided selector.
defaultDispatcherPolicy
private static DispatcherPolicy defaultDispatcherPolicy()