Polish
Issues: SWF-1532
This commit is contained in:
@@ -109,7 +109,8 @@ public class SessionBindingConversationManager implements ConversationManager {
|
||||
// implementing conversation manager
|
||||
|
||||
public Conversation beginConversation(ConversationParameters conversationParameters) throws ConversationException {
|
||||
return getConversationContainer().createConversation(conversationParameters, createConversationLock());
|
||||
ConversationLock lock = new JdkConcurrentConversationLock(lockTimeoutSeconds);
|
||||
return getConversationContainer().createConversation(conversationParameters, lock);
|
||||
}
|
||||
|
||||
public Conversation getConversation(ConversationId id) throws ConversationException {
|
||||
@@ -126,10 +127,6 @@ public class SessionBindingConversationManager implements ConversationManager {
|
||||
|
||||
// hooks for subclassing
|
||||
|
||||
protected ConversationLock createConversationLock() {
|
||||
return new JdkConcurrentConversationLock(lockTimeoutSeconds);
|
||||
}
|
||||
|
||||
protected ConversationContainer createConversationContainer() {
|
||||
return new ConversationContainer(maxConversations, sessionKey);
|
||||
}
|
||||
|
||||
@@ -102,30 +102,25 @@ public abstract class AbstractModel implements Model {
|
||||
parent = new LinkedList<T>(parent);
|
||||
Collections.reverse(parent);
|
||||
}
|
||||
for (T element : parent) {
|
||||
if (!mergeElement(child, element)) {
|
||||
addElement(child, element, addAtEnd);
|
||||
}
|
||||
for (T parentModel : parent) {
|
||||
addOrMerge(child, parentModel, addAtEnd);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
private <T extends Model> boolean mergeElement(LinkedList<T> child, T element) {
|
||||
for (T childElement : child) {
|
||||
if (childElement.isMergeableWith(element)) {
|
||||
childElement.merge(element);
|
||||
return true;
|
||||
private <T extends Model> void addOrMerge(LinkedList<T> list, T modelToMerge, boolean addAtEnd) {
|
||||
for (T model : list) {
|
||||
if (model.isMergeableWith(modelToMerge)) {
|
||||
model.merge(modelToMerge);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends Model> void addElement(LinkedList<T> child, T element, boolean addAtEnd) {
|
||||
@SuppressWarnings("unchecked")
|
||||
T copy = (T) modelToMerge.createCopy();
|
||||
if (addAtEnd) {
|
||||
child.addLast((T) element.createCopy());
|
||||
list.addLast(copy);
|
||||
} else {
|
||||
child.addFirst((T) element.createCopy());
|
||||
list.addFirst(copy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user