org.springframework.integration.aggregator
Class MessageBarrier<T extends java.util.Collection<? extends Message<?>>>

java.lang.Object
  extended by org.springframework.integration.aggregator.MessageBarrier<T>

public class MessageBarrier<T extends java.util.Collection<? extends Message<?>>>
extends java.lang.Object

Utility class for AbstractMessageBarrierHandler and its subclasses for storing objects while in transit. It is a wrapper around a Collection, providing special properties for recording the complete status, the creation time (for determining if a group of messages has timed out), and the correlation id for a group of messages (available after the first message has been added to it). This is a parameterized type, allowing different different client classes to use different types of Collections and their respective features. Can store/retrieve attributes through its setAttribute() and getAttribute() methods. This class is not thread-safe and will be synchronized by the calling code.

Author:
Marius Bogoevici

Field Summary
protected  T messages
           
 
Constructor Summary
MessageBarrier(T messages, java.lang.Object correlationKey)
           
 
Method Summary
<V> V
getAttribute(java.lang.String attributeName)
          Gets the value of a given attribute from the MessageBarrier.
 java.lang.Object getCorrelationKey()
           
 T getMessages()
           
 long getTimestamp()
          Returns the creation time of this barrier as the number of milliseconds since January 1, 1970.
 boolean isComplete()
          True if the barrier has received all the messages and can proceed to release them.
 void setAttribute(java.lang.String attributeName, java.lang.Object value)
          Sets a the value of a given attribute on the MessageBarrier.
 void setComplete()
          Marks the barrier as complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messages

protected final T extends java.util.Collection<? extends Message<?>> messages
Constructor Detail

MessageBarrier

public MessageBarrier(T messages,
                      java.lang.Object correlationKey)
Method Detail

getCorrelationKey

public java.lang.Object getCorrelationKey()

getTimestamp

public long getTimestamp()
Returns the creation time of this barrier as the number of milliseconds since January 1, 1970.

See Also:
System.currentTimeMillis()

setComplete

public void setComplete()
Marks the barrier as complete.


isComplete

public boolean isComplete()
True if the barrier has received all the messages and can proceed to release them.


getMessages

public T getMessages()

setAttribute

public void setAttribute(java.lang.String attributeName,
                         java.lang.Object value)
Sets a the value of a given attribute on the MessageBarrier.

Parameters:
attributeName -
value -

getAttribute

public <V> V getAttribute(java.lang.String attributeName)
Gets the value of a given attribute from the MessageBarrier.

Parameters:
attributeName -