Source:
public final boolean send(Message<?> message, long timeout) { Assert.notNull(message, "message must not be null"); Assert.notNull(message.getPayload(), "message payload must not be null"); if (this.shouldTrack) { message = MessageHistory.write(message, this, this.getMessageBuilderFactory()); } Deque<ChannelInterceptor> interceptorStack = null; boolean sent = false; boolean metricsProcessed = false; MetricsContext metrics = null; boolean countsEnabled = this.countsEnabled; ChannelInterceptorList interceptors = this.interceptors; AbstractMessageChannelMetrics channelMetrics = this.channelMetrics; try { if (this.datatypes.length > 0) { message = this.convertPayloadIfNecessary(message); } if (logger.isDebugEnabled()) { logger.debug("preSend on channel '" + this + "', message: " + message); } boolean hasInterceptors = interceptors.getInterceptors().size() > 0; if (hasInterceptors) { interceptorStack = new ArrayDeque<ChannelInterceptor>(); message = interceptors.preSend(message, this, interceptorStack); if (message == null) { return false; } } if (countsEnabled) { metrics = channelMetrics.beforeSend(); } sent = this.doSend(message, timeout); if (countsEnabled) { channelMetrics.afterSend(metrics, sent); metricsProcessed = true; } if (logger.isDebugEnabled()) { logger.debug("postSend (sent=" + sent + ") on channel '" + this + "', message: " + message); } if (hasInterceptors) { interceptors.postSend(message, this, sent); interceptors.afterSendCompletion(message, this, sent, null, interceptorStack); } return sent; } catch (Exception e) { if (countsEnabled && !metricsProcessed) { channelMetrics.afterSend(metrics, false); } if (interceptorStack != null) { interceptors.afterSendCompletion(message, this, sent, e, interceptorStack); } if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessageDeliveryException(message, "failed to send Message to channel '" + this.getComponentName() + "'", e); } }

Target:
public final boolean send(Message<?> message, long timeout) { Assert.notNull(message, "message must not be null"); Assert.notNull(message.getPayload(), "message payload must not be null"); if (this.shouldTrack) { message = MessageHistory.write(message, this, this.getMessageBuilderFactory()); } Deque<ChannelInterceptor> interceptorStack = null; boolean sent = false; boolean metricsProcessed = false; MetricsContext metrics = null; boolean countsEnabled = this.countsEnabled; ChannelInterceptorList interceptors = this.interceptors; AbstractMessageChannelMetrics channelMetrics = this.channelMetrics; try { if (this.datatypes.length > 0) { message = this.convertPayloadIfNecessary(message); } if (logger.isDebugEnabled()) { logger.debug("preSend on channel '" + this + "', message: " + message); } if (interceptors.getInterceptors().size() > 0) { interceptorStack = new ArrayDeque<ChannelInterceptor>(); message = interceptors.preSend(message, this, interceptorStack); if (message == null) { return false; } } if (countsEnabled) { metrics = channelMetrics.beforeSend(); } sent = this.doSend(message, timeout); if (countsEnabled) { channelMetrics.afterSend(metrics, sent); metricsProcessed = true; } if (logger.isDebugEnabled()) { logger.debug("postSend (sent=" + sent + ") on channel '" + this + "', message: " + message); } if (interceptorStack != null) { interceptors.postSend(message, this, sent); interceptors.afterSendCompletion(message, this, sent, null, interceptorStack); } return sent; } catch (Exception e) { if (countsEnabled && !metricsProcessed) { channelMetrics.afterSend(metrics, false); } if (interceptorStack != null) { interceptors.afterSendCompletion(message, this, sent, e, interceptorStack); } if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessageDeliveryException(message, "failed to send Message to channel '" + this.getComponentName() + "'", e); } }