@Override public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException { boolean async = (msg.getOptions() & Channel.SEND_OPTIONS_ASYNCHRONOUS) == Channel.SEND_OPTIONS_ASYNCHRONOUS; if (async && run) { if ((getCurrentSize()+msg.getMessage().getLength()) > maxQueueSize) { if (alwaysSend) { super.sendMessage(destination,msg,payload); return; } else { throw new ChannelException(sm.getString("messageDispatchInterceptor.queue.full", Long.toString(maxQueueSize), Long.toString(getCurrentSize()))); } } //add to queue if (useDeepClone) { msg = (ChannelMessage)msg.deepclone(); } if (!addToQueue(msg, destination, payload)) { throw new ChannelException( sm.getString("messageDispatchInterceptor.unableAdd.queue")); } addAndGetCurrentSize(msg.getMessage().getLength()); } else { super.sendMessage(destination, msg, payload); } }
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException { boolean async = (msg.getOptions() & Channel.SEND_OPTIONS_ASYNCHRONOUS) == Channel.SEND_OPTIONS_ASYNCHRONOUS; if ( async && run ) { if ( (getCurrentSize()+msg.getMessage().getLength()) > maxQueueSize ) { if ( alwaysSend ) { super.sendMessage(destination,msg,payload); return; } else { throw new ChannelException("Asynchronous queue is full, reached its limit of " + maxQueueSize +" bytes, current:" + getCurrentSize() + " bytes."); }//end if }//end if //add to queue if ( useDeepClone ) msg = (ChannelMessage)msg.deepclone(); if (!addToQueue(msg, destination, payload) ) { throw new ChannelException("Unable to add the message to the async queue, queue bug?"); } addAndGetCurrentSize(msg.getMessage().getLength()); } else { super.sendMessage(destination, msg, payload); } }
@Override public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException { boolean async = (msg.getOptions() & Channel.SEND_OPTIONS_ASYNCHRONOUS) == Channel.SEND_OPTIONS_ASYNCHRONOUS; if ( async && run ) { if ( (getCurrentSize()+msg.getMessage().getLength()) > maxQueueSize ) { if ( alwaysSend ) { super.sendMessage(destination,msg,payload); return; } else { throw new ChannelException("Asynchronous queue is full, reached its limit of " + maxQueueSize +" bytes, current:" + getCurrentSize() + " bytes."); }//end if }//end if //add to queue if ( useDeepClone ) msg = (ChannelMessage)msg.deepclone(); if (!addToQueue(msg, destination, payload) ) { throw new ChannelException("Unable to add the message to the async queue, queue bug?"); } addAndGetCurrentSize(msg.getMessage().getLength()); } else { super.sendMessage(destination, msg, payload); } }
@Override public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException { boolean async = (msg.getOptions() & Channel.SEND_OPTIONS_ASYNCHRONOUS) == Channel.SEND_OPTIONS_ASYNCHRONOUS; if ( async && run ) { if ( (getCurrentSize()+msg.getMessage().getLength()) > maxQueueSize ) { if ( alwaysSend ) { super.sendMessage(destination,msg,payload); return; } else { throw new ChannelException("Asynchronous queue is full, reached its limit of " + maxQueueSize +" bytes, current:" + getCurrentSize() + " bytes."); }//end if }//end if //add to queue if ( useDeepClone ) msg = (ChannelMessage)msg.deepclone(); if (!addToQueue(msg, destination, payload) ) { throw new ChannelException( "Unable to add the message to the async queue, queue bug?"); } addAndGetCurrentSize(msg.getMessage().getLength()); } else { super.sendMessage(destination, msg, payload); } }
addAndGetCurrentSize(-msg.getMessage().getLength());
protected LinkObject sendAsyncData(LinkObject link) { ChannelMessage msg = link.data(); Member[] destination = link.getDestination(); try { super.sendMessage(destination,msg,null); try { if ( link.getHandler() != null ) link.getHandler().handleCompletion(new UniqueId(msg.getUniqueId())); } catch ( Exception ex ) { log.error("Unable to report back completed message.",ex); } } catch ( Exception x ) { ChannelException cx = null; if ( x instanceof ChannelException ) cx = (ChannelException)x; else cx = new ChannelException(x); if ( log.isDebugEnabled() ) log.debug("Error while processing async message.",x); try { if (link.getHandler() != null) link.getHandler().handleError(cx, new UniqueId(msg.getUniqueId())); } catch ( Exception ex ) { log.error("Unable to report back error message.",ex); } } finally { addAndGetCurrentSize(-msg.getMessage().getLength()); link = link.next(); }//try return link; }
protected LinkObject sendAsyncData(LinkObject link) { ChannelMessage msg = link.data(); Member[] destination = link.getDestination(); try { super.sendMessage(destination,msg,null); try { if (link.getHandler() != null) { link.getHandler().handleCompletion(new UniqueId(msg.getUniqueId())); } } catch ( Exception ex ) { log.error("Unable to report back completed message.",ex); } } catch ( Exception x ) { ChannelException cx = null; if ( x instanceof ChannelException ) cx = (ChannelException)x; else cx = new ChannelException(x); if ( log.isDebugEnabled() ) log.debug("Error while processing async message.",x); try { if (link.getHandler() != null) { link.getHandler().handleError(cx, new UniqueId(msg.getUniqueId())); } } catch ( Exception ex ) { log.error("Unable to report back error message.",ex); } } finally { addAndGetCurrentSize(-msg.getMessage().getLength()); link = link.next(); }//try return link; }
protected LinkObject sendAsyncData(LinkObject link) { ChannelMessage msg = link.data(); Member[] destination = link.getDestination(); try { super.sendMessage(destination,msg,null); try { if ( link.getHandler() != null ) link.getHandler().handleCompletion(new UniqueId(msg.getUniqueId())); } catch ( Exception ex ) { log.error("Unable to report back completed message.",ex); } } catch ( Exception x ) { ChannelException cx = null; if ( x instanceof ChannelException ) cx = (ChannelException)x; else cx = new ChannelException(x); if ( log.isDebugEnabled() ) log.debug("Error while processing async message.",x); try { if (link.getHandler() != null) link.getHandler().handleError(cx, new UniqueId(msg.getUniqueId())); } catch ( Exception ex ) { log.error("Unable to report back error message.",ex); } } finally { addAndGetCurrentSize(-msg.getMessage().getLength()); link = link.next(); }//try return link; }