GlobalChannelInterceptorWrapper no longer implements ChannelInterceptor itself. It only passes the wrapped instance into the channel.

This commit is contained in:
Mark Fisher
2010-11-10 08:06:13 -05:00
parent 4b4a6fdb94
commit f6fc550966
2 changed files with 10 additions and 21 deletions

View File

@@ -101,7 +101,9 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess
}
}
Collections.sort(tempInterceptors, this.comparator);
interceptors.addAll(tempInterceptors);
for (GlobalChannelInterceptorWrapper next : tempInterceptors) {
interceptors.add(next.getChannelInterceptor());
}
tempInterceptors = new ArrayList<GlobalChannelInterceptorWrapper>();
for (GlobalChannelInterceptorWrapper globalChannelInterceptorWrapper : this.negativeOrderInterceptors) {
String[] patterns = globalChannelInterceptorWrapper.getPatterns();
@@ -111,7 +113,11 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess
}
}
Collections.sort(tempInterceptors, comparator);
interceptors.addAll(0, tempInterceptors);
if (!tempInterceptors.isEmpty()) {
for (int i = tempInterceptors.size() - 1; i >= 0; i--) {
interceptors.add(0, tempInterceptors.get(i).getChannelInterceptor());
}
}
}
else if (logger.isDebugEnabled()) {
logger.debug("Global Channel interceptors will not be applied to Channel: " + beanName);

View File

@@ -17,16 +17,15 @@
package org.springframework.integration.channel.interceptor;
import org.springframework.core.Ordered;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.channel.ChannelInterceptor;
import org.springframework.util.Assert;
/**
* @author Oleg Zhurakousky
* @author Mark Fisher
* @since 2.0
*/
public class GlobalChannelInterceptorWrapper implements ChannelInterceptor, Ordered {
public class GlobalChannelInterceptorWrapper implements Ordered {
private final ChannelInterceptor channelInterceptor;
@@ -66,22 +65,6 @@ public class GlobalChannelInterceptorWrapper implements ChannelInterceptor, Orde
return this.patterns;
}
public Message<?> preSend(Message<?> message, MessageChannel channel) {
return this.channelInterceptor.preSend(message, channel);
}
public void postSend(Message<?> message, MessageChannel channel, boolean sent) {
this.channelInterceptor.postSend(message, channel, sent);
}
public boolean preReceive(MessageChannel channel) {
return this.channelInterceptor.preReceive(channel);
}
public Message<?> postReceive(Message<?> message, MessageChannel channel) {
return this.channelInterceptor.postReceive(message, channel);
}
public String toString() {
return this.channelInterceptor.toString();
}