Use InterceptableChannel in AbstractBrokerMessageHandler

Issue: SPR-12218
This commit is contained in:
Rossen Stoyanchev 2014-09-26 13:25:52 -04:00
parent 6f1ab8d02d
commit ceb79c9bee
1 changed files with 5 additions and 5 deletions

View File

@ -32,9 +32,9 @@ import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel; import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
import org.springframework.messaging.simp.SimpMessageType; import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.messaging.support.AbstractMessageChannel;
import org.springframework.messaging.support.ChannelInterceptor; import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.messaging.support.ChannelInterceptorAdapter; import org.springframework.messaging.support.ChannelInterceptorAdapter;
import org.springframework.messaging.support.InterceptableChannel;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -172,8 +172,8 @@ public abstract class AbstractBrokerMessageHandler
} }
this.clientInboundChannel.subscribe(this); this.clientInboundChannel.subscribe(this);
this.brokerChannel.subscribe(this); this.brokerChannel.subscribe(this);
if (this.clientInboundChannel instanceof AbstractMessageChannel) { if (this.clientInboundChannel instanceof InterceptableChannel) {
((AbstractMessageChannel) this.clientInboundChannel).addInterceptor(0, this.unsentDisconnectInterceptor); ((InterceptableChannel) this.clientInboundChannel).addInterceptor(0, this.unsentDisconnectInterceptor);
} }
startInternal(); startInternal();
this.running = true; this.running = true;
@ -195,8 +195,8 @@ public abstract class AbstractBrokerMessageHandler
stopInternal(); stopInternal();
this.clientInboundChannel.unsubscribe(this); this.clientInboundChannel.unsubscribe(this);
this.brokerChannel.unsubscribe(this); this.brokerChannel.unsubscribe(this);
if (this.clientInboundChannel instanceof AbstractMessageChannel) { if (this.clientInboundChannel instanceof InterceptableChannel) {
((AbstractMessageChannel) this.clientInboundChannel).removeInterceptor(this.unsentDisconnectInterceptor); ((InterceptableChannel) this.clientInboundChannel).removeInterceptor(this.unsentDisconnectInterceptor);
} }
this.running = false; this.running = false;
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {