INT-3534:MethodInvokingMLP Don't Copy Collection
JIRA: https://jira.spring.io/browse/INT-3534 Previously the `MethodInvokingMessageListProcessor` copied `Collection<Message<?>>` in its `process()` method for the `delegate` to a new `Collection` unconditionally. To improve performance, the collection is no longer copied unconditionally in the `ExpressionEvaluatingMessageGroupProcessor`. Also add an `important` note to the `aggregator.adoc` about the restriction with `unmodifiableCollection`.
This commit is contained in:
committed by
Gary Russell
parent
15e2187fd2
commit
51b161ae4d
@@ -18,14 +18,13 @@ package org.springframework.integration.aggregator;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.util.AbstractExpressionEvaluator;
|
||||
import org.springframework.integration.util.MessagingMethodInvokerHelper;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* A MessageListProcessor implementation that invokes a method on a target POJO.
|
||||
@@ -69,9 +68,9 @@ public class MethodInvokingMessageListProcessor<T> extends AbstractExpressionEva
|
||||
return delegate.toString();
|
||||
}
|
||||
|
||||
public T process(Collection<? extends Message<?>> messages, Map<String, Object> aggregateHeaders) {
|
||||
public T process(Collection<Message<?>> messages, Map<String, Object> aggregateHeaders) {
|
||||
try {
|
||||
return delegate.process(new ArrayList<Message<?>>(messages), aggregateHeaders);
|
||||
return delegate.process(messages, aggregateHeaders);
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user