Tabnine Logo
MessageDispatchInterceptor.addAndGetCurrentSize
Code IndexAdd Tabnine to your IDE (free)

How to use
addAndGetCurrentSize
method
in
org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor

Best Java code snippets using org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.addAndGetCurrentSize (Showing top 8 results out of 315)

origin: org.apache.tomcat/tomcat-tribes

@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);
  }
}
origin: org.apache.catalina.springsource/com.springsource.org.apache.catalina.tribes.springsource

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);
  }
}

origin: org.apache.geronimo.ext.tomcat/tribes

@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);
  }
}

origin: codefollower/Tomcat-Research

@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);
  }
}
origin: org.apache.tomcat/tomcat-tribes

addAndGetCurrentSize(-msg.getMessage().getLength());
origin: org.apache.catalina.springsource/com.springsource.org.apache.catalina.tribes.springsource

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;
}
origin: codefollower/Tomcat-Research

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;
}
origin: org.apache.geronimo.ext.tomcat/tribes

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;
}
org.apache.catalina.tribes.group.interceptorsMessageDispatchInterceptoraddAndGetCurrentSize

Popular methods of MessageDispatchInterceptor

  • addToQueue
  • getCurrentSize
  • sendAsyncData
  • setAndGetCurrentSize
  • setOptionFlag
  • startQueue
  • stopQueue
  • removeFromQueue
  • <init>
  • getChannel

Popular in Java

  • Creating JSON documents from java classes using gson
  • addToBackStack (FragmentTransaction)
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Runner (org.openjdk.jmh.runner)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now