org.springframework.integration.message
Class RetrievalBlockingMessageStore
java.lang.Object
org.springframework.integration.message.RetrievalBlockingMessageStore
- All Implemented Interfaces:
- MessageStore
public class RetrievalBlockingMessageStore
- extends java.lang.Object
- implements MessageStore
A MessageStore
implementation whose get
and
remove
methods block until a message is available.
Alternative methods that accept an explicit timeout value are also available.
- Author:
- Mark Fisher
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
targetMessageStore
private final MessageStore targetMessageStore
listeners
private final java.util.concurrent.ConcurrentMap<java.lang.Object,java.util.List<java.util.concurrent.SynchronousQueue<RetrievalBlockingMessageStore.MessageHolder>>> listeners
listenerMonitor
private final java.lang.Object listenerMonitor
RetrievalBlockingMessageStore
public RetrievalBlockingMessageStore(MessageStore messageStore)
- Create a wrapper for the provided
MessageStore
so that its
retrieval methods will block.
- Parameters:
messageStore
- the MessageStore instance to wrap
RetrievalBlockingMessageStore
public RetrievalBlockingMessageStore(int capacity)
- Create a wrapper for a
SimpleMessageStore
so that its
retrieval methods will block.
- Parameters:
capacity
- the capacity of the MessageStore
size
public int size()
- Specified by:
size
in interface MessageStore
put
public Message<?> put(java.lang.Object key,
Message<?> message)
- Specified by:
put
in interface MessageStore
get
public Message<?> get(java.lang.Object key)
- Specified by:
get
in interface MessageStore
get
public Message<?> get(java.lang.Object key,
long timeout)
remove
public Message<?> remove(java.lang.Object key)
- Specified by:
remove
in interface MessageStore
remove
public Message<?> remove(java.lang.Object key,
long timeout)
waitForMessage
private Message<?> waitForMessage(java.lang.Object key,
long timeout,
boolean shouldRemove)