logger.trace("preReceive on channel '" + this + "'"); if (interceptorList.getSize() > 0) { interceptorStack = new ArrayDeque<>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; message = interceptorList.postReceive(message, this); interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); interceptorList.afterReceiveCompletion(null, this, e, interceptorStack);
logger.trace("preReceive on channel '" + this + "'"); if (interceptorList.getInterceptors().size() > 0) { interceptorStack = new ArrayDeque<>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; message = interceptorList.postReceive(message, this); interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); interceptorList.afterReceiveCompletion(null, this, e, interceptorStack);
logger.debug("preSend on channel '" + this + "', message: " + message); if (interceptorList.getSize() > 0) { interceptorStack = new ArrayDeque<>(); message = interceptorList.preSend(message, this, interceptorStack); if (message == null) { return false; interceptorList.postSend(message, this, sent); interceptorList.afterSendCompletion(message, this, sent, null, interceptorStack); interceptorList.afterSendCompletion(message, this, sent, e, interceptorStack);
logger.debug("preSend on channel '" + this + "', message: " + message); if (interceptorList.getSize() > 0) { interceptorStack = new ArrayDeque<>(); message = interceptorList.preSend(message, this, interceptorStack); if (message == null) { return false; interceptorList.postSend(message, this, sent); interceptorList.afterSendCompletion(message, this, sent, null, interceptorStack); interceptorList.afterSendCompletion(message, this, sent, e, interceptorStack);
logger.trace("preReceive on channel '" + this + "'"); if (interceptorList.getInterceptors().size() > 0) { interceptorStack = new ArrayDeque<>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; message = interceptorList.postReceive(message, this); interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); interceptorList.afterReceiveCompletion(null, this, e, interceptorStack);
logger.trace("preReceive on channel '" + this + "'"); if (interceptorList.getSize() > 0) { interceptorStack = new ArrayDeque<>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; message = interceptorList.postReceive(message, this); interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); interceptorList.afterReceiveCompletion(null, this, e, interceptorStack);
logger.trace("preReceive on channel '" + this + "'"); if (interceptorList.getInterceptors().size() > 0) { interceptorStack = new ArrayDeque<>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; message = interceptorList.postReceive(message, this); interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); interceptorList.afterReceiveCompletion(null, this, e, interceptorStack);
/** * Send a message on this channel. If the channel is at capacity, this * method will block until either the timeout occurs or the sending thread * is interrupted. If the specified timeout is 0, the method will return * immediately. If less than zero, it will block indefinitely (see * {@link #send(Message)}). * * @param message the Message to send * @param timeout the timeout in milliseconds * * @return <code>true</code> if the message is sent successfully, * <code>false</code> if the message cannot be sent within the allotted * time or the sending thread is interrupted. */ public final boolean send(Message<?> message, long timeout) { message = this.interceptors.preSend(message, this); if (message == null) { return false; } boolean sent = this.doSend(message, timeout); this.interceptors.postSend(message, this, sent); return sent; }
/** * Receive the first available message from this channel. If the channel * contains no messages, this method will block until the allotted timeout * elapses. If the specified timeout is 0, the method will return * immediately. If less than zero, it will block indefinitely (see * {@link #receive()}). * * @param timeout the timeout in milliseconds * * @return the first available message or <code>null</code> if no message * is available within the allotted time or the receiving thread is * interrupted. */ public final Message<?> receive(long timeout) { if (!this.getInterceptors().preReceive(this)) { return null; } Message<?> message = this.doReceive(timeout); message = this.getInterceptors().postReceive(message, this); return message; }
/** * Set the list of channel interceptors. This will clear any existing * interceptors. */ public void setInterceptors(List<ChannelInterceptor> interceptors) { this.interceptors.set(interceptors); }
/** * Add a channel interceptor to the end of the list. */ public void addInterceptor(ChannelInterceptor interceptor) { this.interceptors.add(interceptor); }
/** * Return a read-only list of the configured interceptors. */ @Override public List<ChannelInterceptor> getChannelInterceptors() { return this.interceptors.getInterceptors(); }
/** * Add a channel interceptor to the specified index of the list. * @param index The index to add interceptor. * @param interceptor The interceptor. */ @Override public void addInterceptor(int index, ChannelInterceptor interceptor) { this.interceptors.add(index, interceptor); }
public boolean preReceive(MessageChannel channel, Deque<ChannelInterceptor> interceptorStack) { if (this.size > 0) { for (ChannelInterceptor interceptor : this.interceptors) { if (!interceptor.preReceive(channel)) { afterReceiveCompletion(null, channel, null, interceptorStack); return false; } interceptorStack.add(interceptor); } } return true; }
/** * Add a channel interceptor to the end of the list. * @param interceptor The interceptor. */ @Override public void addInterceptor(ChannelInterceptor interceptor) { this.interceptors.add(interceptor); }
/** * Set the list of channel interceptors. This will clear any existing * interceptors. * @param interceptors The list of interceptors. */ @Override public void setInterceptors(List<ChannelInterceptor> interceptors) { Collections.sort(interceptors, this.orderComparator); this.interceptors.set(interceptors); }
logger.trace("preReceive on channel '" + this + "'"); if (interceptorList.getInterceptors().size() > 0) { interceptorStack = new ArrayDeque<>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; message = interceptorList.postReceive(message, this); interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); interceptorList.afterReceiveCompletion(null, this, e, interceptorStack);
/** * Return a read-only list of the configured interceptors. */ @Override public List<ChannelInterceptor> getChannelInterceptors() { return this.interceptors.getInterceptors(); }
/** * Add a channel interceptor to the specified index of the list. * @param index The index to add interceptor. * @param interceptor The interceptor. */ @Override public void addInterceptor(int index, ChannelInterceptor interceptor) { this.interceptors.add(index, interceptor); }
/** * Add a channel interceptor to the end of the list. * @param interceptor The interceptor. */ @Override public void addInterceptor(ChannelInterceptor interceptor) { this.interceptors.add(interceptor); }