From f6fc5509663880c673abb47704ee9b6f51971551 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Wed, 10 Nov 2010 08:06:13 -0500 Subject: [PATCH] GlobalChannelInterceptorWrapper no longer implements ChannelInterceptor itself. It only passes the wrapped instance into the channel. --- ...alChannelInterceptorBeanPostProcessor.java | 10 +++++++-- .../GlobalChannelInterceptorWrapper.java | 21 ++----------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java index d124715a53..9db4cce9fb 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java @@ -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(); 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); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java index b88f715d83..2f34935cc7 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorWrapper.java @@ -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(); }