public class SessionBindingConversationManager extends java.lang.Object implements ConversationManager
Using the maxConversations property, you can limit the number of concurrently
active conversations allowed in a single session. If the maximum is exceeded, the conversation manager will
automatically end the oldest conversation. The default is 5, which should be fine for most situations. Set it to -1
for no limit. Setting maxConversations to 1 allows easy resource cleanup in situations where there should only be one
active conversation per session.
| Constructor and Description |
|---|
SessionBindingConversationManager() |
| Modifier and Type | Method and Description |
|---|---|
Conversation |
beginConversation(ConversationParameters conversationParameters)
Begin a new conversation.
|
protected org.springframework.webflow.conversation.impl.ConversationContainer |
createConversationContainer() |
Conversation |
getConversation(ConversationId id)
Get the conversation with the provided id.
|
int |
getLockTimeoutSeconds()
Returns the time period that can elapse before a timeout occurs on an attempt to acquire a conversation lock.
|
int |
getMaxConversations()
Returns the maximum number of allowed concurrent conversations.
|
java.lang.String |
getSessionKey()
Returns the key this conversation manager uses to store conversation data in the session.
|
ConversationId |
parseConversationId(java.lang.String encodedId)
Parse the string-encoded conversationId into its object form.
|
void |
setLockTimeoutSeconds(int timeoutSeconds)
Sets the time period that can elapse before a timeout occurs on an attempt to acquire a conversation lock.
|
void |
setMaxConversations(int maxConversations)
Set the maximum number of allowed concurrent conversations.
|
void |
setSessionKey(java.lang.String sessionKey)
Sets the key this conversation manager uses to store conversation data in the session.
|
public java.lang.String getSessionKey()
public void setSessionKey(java.lang.String sessionKey)
sessionKey - the session keypublic int getMaxConversations()
public void setMaxConversations(int maxConversations)
public int getLockTimeoutSeconds()
public void setLockTimeoutSeconds(int timeoutSeconds)
timeoutSeconds - the timeout period in secondspublic Conversation beginConversation(ConversationParameters conversationParameters) throws ConversationException
ConversationManagerbeginConversation in interface ConversationManagerconversationParameters - descriptive conversation parametersConversationException - an exception occuredpublic Conversation getConversation(ConversationId id) throws ConversationException
ConversationManagerImplementors should take care to manage conversation identity correctly. Although it is not strictly required to return the same (==) Conversation object every time this method is called with a particular conversation id in a single execution thread, callers will expect to recieve an object that allows them to manipulate the identified conversation. In other words, the following is legal ConversationManager client code:
ConversationManager manager = ...;
ConversationId id = ...;
Conversation conv = manager.getConversation(id);
conv.lock();
try {
Conversation localReference = manager.getConversation(id);
// no need to lock since conversation 'id' is already locked
// even though possibly conv != localReference
localReference.putAttribute("foo", "bar");
Object foo = conv.getAttribute("foo");
}
finally {
conv.unlock();
}
getConversation in interface ConversationManagerid - the conversation idNoSuchConversationException - the id provided was invalidConversationExceptionpublic ConversationId parseConversationId(java.lang.String encodedId) throws ConversationException
ConversationManagerConversationId.toString().parseConversationId in interface ConversationManagerencodedId - the encoded idConversationException - an exception occured parsing the idprotected org.springframework.webflow.conversation.impl.ConversationContainer createConversationContainer()