org.springframework.integration.channel
Class ThreadLocalChannel
java.lang.Object
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.channel.AbstractPollableChannel
org.springframework.integration.channel.ThreadLocalChannel
- All Implemented Interfaces:
- org.springframework.beans.factory.BeanNameAware, PollableChannel, MessageChannel
public class ThreadLocalChannel
- extends AbstractPollableChannel
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
Method Summary |
java.util.List<Message<?>> |
clear()
Remove and return any messages that are stored for the current thread. |
protected Message<?> |
doReceive(long timeout)
Subclasses must implement this method. |
protected boolean |
doSend(Message<?> message,
long timeout)
Subclasses must implement this method. |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ThreadLocalChannel
public ThreadLocalChannel()
doReceive
protected Message<?> doReceive(long timeout)
- Description copied from class:
AbstractPollableChannel
- 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 AbstractPollableChannel
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.