Browse Source

Use InterceptableChannel in AbstractBrokerMessageHandler

Issue: SPR-12218
pull/639/merge
Rossen Stoyanchev 11 years ago
parent
commit
ceb79c9bee
  1. 10
      spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java

10
spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java

@ -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()) {

Loading…
Cancel
Save