Interface Conversation

All Known Implementing Classes:
ContainedConversation

public interface Conversation
A service interface for working with state associated with a single logical user interaction called a "conversation" in the scope of a single request. Conversation objects are not thread safe and should not be shared among multiple threads.

A conversation provides a "task" context that is begun and eventually ends. Between the beginning and the end attributes can be placed in and read from a conversation's context.

A conversation needs to be locked to obtain exclusive access to it before it can be manipulated. Once manipulation is finished, you need to unlock the conversation. So code interacting with a conversation always looks like this:

 Conversation conv = ...;
 conv.lock();
 try {
    // work with the Conversation object, calling methods like
    // getAttribute(), putAttribute() and end()
 }
 finally {
    conv.unlock();
 }
 

Note that the attributes associated with a conversation are not "conversation scope" as defined for a flow execution. They can be any attributes, possibly technical in nature, associated with the conversation.

Author:
Keith Donald, Erwin Vervaet
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    end()
    Ends this conversation.
    Returns the conversation attribute with the specified name.
    Returns the unique id assigned to this conversation.
    void
    Lock this conversation.
    void
    putAttribute(Object name, Object value)
    Puts a conversation attribute into this context.
    void
    Removes a conversation attribute.
    void
    Unlock this conversation, making it available to others for manipulation.
  • Method Details

    • getId

      Returns the unique id assigned to this conversation. This id remains the same throughout the life of the conversation. This method can be safely called without owning the lock of this conversation.
      Returns:
      the conversation id
    • lock

      void lock() throws ConversationLockException
      Lock this conversation. May block until the lock is available, if someone else has acquired the lock.
      Throws:
      ConversationLockException - if the lock could not be acquired
    • getAttribute

      Object getAttribute(Object name)
      Returns the conversation attribute with the specified name. You need to acquire the lock on this conversation before calling this method.
      Parameters:
      name - the attribute name
      Returns:
      the attribute value
    • putAttribute

      void putAttribute(Object name, Object value)
      Puts a conversation attribute into this context. You need to acquire the lock on this conversation before calling this method.
      Parameters:
      name - the attribute name
      value - the attribute value
    • removeAttribute

      void removeAttribute(Object name)
      Removes a conversation attribute. You need to acquire the lock on this conversation before calling this method.
      Parameters:
      name - the attribute name
    • end

      void end()
      Ends this conversation. This method should only be called once to terminate the conversation and cleanup any allocated resources. You need to aquire the lock on this conversation before calling this method.
    • unlock

      void unlock()
      Unlock this conversation, making it available to others for manipulation.