类org.springframework.messaging.support.AbstractMessageChannel源码实例Demo

下面列出了怎么用org.springframework.messaging.support.AbstractMessageChannel的API类实例代码及写法,或者点击链接到github查看源代码。

private boolean detectImmutableMessageInterceptor(MessageChannel channel) {
	if (this.immutableMessageInterceptorPresent != null) {
		return this.immutableMessageInterceptorPresent;
	}

	if (channel instanceof AbstractMessageChannel) {
		for (ChannelInterceptor interceptor : ((AbstractMessageChannel) channel).getInterceptors()) {
			if (interceptor instanceof ImmutableMessageChannelInterceptor) {
				this.immutableMessageInterceptorPresent = true;
				return true;
			}
		}
	}
	this.immutableMessageInterceptorPresent = false;
	return false;
}
 
private boolean detectImmutableMessageInterceptor(MessageChannel channel) {
	if (this.immutableMessageInterceptorPresent != null) {
		return this.immutableMessageInterceptorPresent;
	}

	if (channel instanceof AbstractMessageChannel) {
		for (ChannelInterceptor interceptor : ((AbstractMessageChannel) channel).getInterceptors()) {
			if (interceptor instanceof ImmutableMessageChannelInterceptor) {
				this.immutableMessageInterceptorPresent = true;
				return true;
			}
		}
	}
	this.immutableMessageInterceptorPresent = false;
	return false;
}
 
public static void messageChannelSend(final Object thiz) {
  final AbstractMessageChannel channel = (AbstractMessageChannel)thiz;
  for (final ChannelInterceptor interceptor : channel.getInterceptors())
    if (interceptor instanceof TracingChannelInterceptor)
      return;

  final TracingChannelInterceptor tracingChannelInterceptor;
  if (channel.getBeanName().equals("clientOutboundChannel"))
    tracingChannelInterceptor = new TracingChannelInterceptor(GlobalTracer.get(), Tags.SPAN_KIND_CLIENT);
  else if (channel.getBeanName().equals("clientInboundChannel"))
    tracingChannelInterceptor = new TracingChannelInterceptor(GlobalTracer.get(), Tags.SPAN_KIND_SERVER);
  else
    return;

  channel.addInterceptor(tracingChannelInterceptor);
}
 
private boolean detectImmutableMessageInterceptor(MessageChannel channel) {
	if (this.immutableMessageInterceptorPresent != null) {
		return this.immutableMessageInterceptorPresent;
	}

	if (channel instanceof AbstractMessageChannel) {
		for (ChannelInterceptor interceptor : ((AbstractMessageChannel) channel).getInterceptors()) {
			if (interceptor instanceof ImmutableMessageChannelInterceptor) {
				this.immutableMessageInterceptorPresent = true;
				return true;
			}
		}
	}
	this.immutableMessageInterceptorPresent = false;
	return false;
}
 
 类方法
 同包方法