public interface Conversation
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.
Modifier and Type | Method and Description |
---|---|
void |
end()
Ends this conversation.
|
Object |
getAttribute(Object name)
Returns the conversation attribute with the specified name.
|
ConversationId |
getId()
Returns the unique id assigned to this conversation.
|
void |
lock()
Lock this conversation.
|
void |
putAttribute(Object name,
Object value)
Puts a conversation attribute into this context.
|
void |
removeAttribute(Object name)
Removes a conversation attribute.
|
void |
unlock()
Unlock this conversation, making it available to others for manipulation.
|
ConversationId getId()
void lock() throws ConversationLockException
ConversationLockException
- if the lock could not be acquiredObject getAttribute(Object name)
name
- the attribute namevoid putAttribute(Object name, Object value)
name
- the attribute namevalue
- the attribute valuevoid removeAttribute(Object name)
name
- the attribute namevoid end()
void unlock()