INT-2518 addressed Resequencer with custom comparator

removed setComparator(..) method from ResequencingMessageGroupProcessor, fixed tests. More details as to why are available in JIRA https://jira.springsource.org/browse/INT-2518
This commit is contained in:
Oleg Zhurakousky
2012-06-06 10:08:05 -04:00
parent 49960f3f36
commit c377b82d8a
4 changed files with 40 additions and 117 deletions

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2002-2011 the original author or authors.
*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
@@ -13,11 +13,15 @@
package org.springframework.integration.aggregator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.springframework.integration.Message;
import org.springframework.integration.store.MessageGroup;
import java.util.*;
/**
* This class implements all the strategy interfaces needed for a default resequencer.
*
@@ -28,17 +32,8 @@ import java.util.*;
*/
public class ResequencingMessageGroupProcessor implements MessageGroupProcessor {
private volatile Comparator<Message<?>> comparator = new SequenceNumberComparator();
private final Comparator<Message<?>> comparator = new SequenceNumberComparator();
/**
* A comparator to use to order messages before processing. The default is to order by sequence number.
*
* @param comparator the comparator to use to order messages
*/
public void setComparator(Comparator<Message<?>> comparator) {
this.comparator = comparator;
}
public Object processMessageGroup(MessageGroup group) {
Collection<Message<?>> messages = group.getMessages();
@@ -57,7 +52,7 @@ public class ResequencingMessageGroupProcessor implements MessageGroupProcessor
}
partialSequence.add(message);
}
return partialSequence;
}
return null;