mam.transaction
Class MessageWaiter

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--mam.transaction.MessageWaiter

public class MessageWaiter
extends Thread


Field Summary
 final static longDEFAULT_TIME_OUT
           
 final static longDEFAULT_UPDATE_PERIOD
           
 (package private) static CategoryLog
           
 private Collectionm_allResponses
           
 private booleanm_done
           
 private booleanm_exitAfterQuota
           
 private Datem_expirationDate
           
 private Serializablem_identifier
           
 private Collectionm_listeners
           
 private Collectionm_originalMessages
           
 private Collectionm_recentResponses
           
 private Mapm_sentMessageIds
           
 private Collectionm_sentMessages
           
 private longm_updatePeriod
           
 private booleanm_valid
           

Fields inherited from class java.lang.Thread
MIN_PRIORITY, NORM_PRIORITY, MAX_PRIORITY

Constructor Summary
MessageWaiter(String identifier, Collection originalMessages, Collection sentMessages, boolean exitAfterQuota)
           
MessageWaiter(String identifier, Collection originalMessages, Collection sentMessages, long timeOut, long updatePeriod, boolean exitAfterQuota)
           

Method Summary
 synchronized voidaddListener(MessageWaiterListener newListener)
           
 protected synchronized voidaddResponse(AgentMessage newResponse)
           
 booleanevaluateMessage(AgentMessage incomingMessage)
           
 protected voidfinished()
           
 synchronized CollectiongetAllResponses()
           
 booleangetDone()
           
 booleangetExitAfterQuota()
           
 DategetExpirationDate()
           
 SerializablegetIdentifier()
           
 protected CollectiongetListeners()
           
 synchronized CollectiongetOriginalMessages()
           
 CollectiongetRecentResponses()
           
 synchronized CollectiongetSentMessages()
           
 longgetUpdatePeriod()
           
 protected voidinvalidateRecentResponses()
           
 protected booleanisExpired()
           
 booleanisMissingResponses()
           
 protected synchronized voidnotifyListeners()
           
 voidrun()
           
 voidsetExitAfterQuota(boolean exitAfterQuota)
           
 protected voidsetIdentifier(Serializable identifier)
           
 protected synchronized voidsetTimeOut(long timeOut)
           
 synchronized voidsetUpdatePeriod(long updatePeriod)
           
 voidsignalDone()
           
 protected voidupdateQuota()
           

Methods inherited from class java.lang.Thread
currentThread, yield, sleep, sleep, start, stop, stop, interrupt, interrupted, isInterrupted, destroy, isAlive, suspend, resume, setPriority, getPriority, setName, getName, getThreadGroup, activeCount, enumerate, countStackFrames, join, join, join, dumpStack, setDaemon, isDaemon, checkAccess, toString, getContextClassLoader, setContextClassLoader

Methods inherited from class java.lang.Object
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize

Field Detail

DEFAULT_TIME_OUT

public final static long DEFAULT_TIME_OUT

DEFAULT_UPDATE_PERIOD

public final static long DEFAULT_UPDATE_PERIOD

Log

static Category Log

m_allResponses

private Collection m_allResponses

m_done

private boolean m_done

m_exitAfterQuota

private boolean m_exitAfterQuota

m_expirationDate

private Date m_expirationDate

m_identifier

private Serializable m_identifier

m_listeners

private Collection m_listeners

m_originalMessages

private Collection m_originalMessages

m_recentResponses

private Collection m_recentResponses

m_sentMessageIds

private Map m_sentMessageIds

m_sentMessages

private Collection m_sentMessages

m_updatePeriod

private long m_updatePeriod

m_valid

private boolean m_valid
Constructor Detail

MessageWaiter

public MessageWaiter(String identifier, Collection originalMessages, Collection sentMessages, boolean exitAfterQuota)

MessageWaiter

public MessageWaiter(String identifier, Collection originalMessages, Collection sentMessages, long timeOut, long updatePeriod, boolean exitAfterQuota)
Method Detail

addListener

public synchronized void addListener(MessageWaiterListener newListener)

addResponse

protected synchronized void addResponse(AgentMessage newResponse)

evaluateMessage

public boolean evaluateMessage(AgentMessage incomingMessage)

finished

protected void finished()

getAllResponses

public synchronized Collection getAllResponses()

getDone

public boolean getDone()

getExitAfterQuota

public boolean getExitAfterQuota()

getExpirationDate

public Date getExpirationDate()

getIdentifier

public Serializable getIdentifier()

getListeners

protected Collection getListeners()

getOriginalMessages

public synchronized Collection getOriginalMessages()

getRecentResponses

public Collection getRecentResponses()

getSentMessages

public synchronized Collection getSentMessages()

getUpdatePeriod

public long getUpdatePeriod()

invalidateRecentResponses

protected void invalidateRecentResponses()

isExpired

protected boolean isExpired()

isMissingResponses

public boolean isMissingResponses()

notifyListeners

protected synchronized void notifyListeners()

run

public void run()

setExitAfterQuota

public void setExitAfterQuota(boolean exitAfterQuota)

setIdentifier

protected void setIdentifier(Serializable identifier)

setTimeOut

protected synchronized void setTimeOut(long timeOut)

setUpdatePeriod

public synchronized void setUpdatePeriod(long updatePeriod)

signalDone

public void signalDone()

updateQuota

protected void updateQuota()