Examples of Dispatcher


Examples of org.apache.niolex.commons.seda.Dispatcher

    /**
     * @param args
     */
    public static void main(String[] args) {
        Dispatcher disp = Dispatcher.getInstance();
        ThreadGroup group = ThreadUtil.topGroup();
        StopWatch sw = new StopWatch(10);
        disp.register(new InputStage(sw));
        disp.register(new LightStage());
        disp.register(new WeightStage());
        disp.register(new FinishStage());

        disp.construction();
        disp.startAdjust(1000);
        group.list();
        sw.begin(false);

        System.out.println("Stage 1 - dispatch 5K/s, 100(1ms) : 1(100ms) weight messages; for 30 sec.");

        for (int i = 0; i < 30; ++i) {
            for (int j = 0; j < 5000; ++j) {
                if (j % 100 == 50) {
                    disp.dispatch("input", new WeightMessage(100));
                } else {
                    disp.dispatch("input", new WeightMessage(1));
                }
                if (j % 5 == 1) {
                    ThreadUtil.sleep(1);
                }
            }
        }
        group.list();

        System.out.println("Stage 2 - dispatch 1K/s, 1(1ms) : 1(10ms) weight messages; for 30 sec.");

        for (int i = 0; i < 30; ++i) {
            for (int j = 0; j < 1000; ++j) {
                if (j % 2 == 1) {
                    disp.dispatch("input", new WeightMessage(10));
                } else {
                    disp.dispatch("input", new WeightMessage(1));
                }
                ThreadUtil.sleep(1);
            }
        }
        group.list();

        System.out.println("Stage 3 - dispatch 10K/s, 1(1ms) : 1(10ms) weight messages; for 30 sec.");

        for (int i = 0; i < 30; ++i) {
            for (int j = 0; j < 10000; ++j) {
                if (j % 2 == 1) {
                    disp.dispatch("input", new WeightMessage(10));
                } else {
                    disp.dispatch("input", new WeightMessage(1));
                }
                if (j % 10 == 1) {
                    ThreadUtil.sleep(1);
                }
            }
        }
        group.list();

        System.out.println("Stage 4 - dispatch 10K/s, 1(1ms) : 1(3ms) weight messages; for 30 sec.");

        for (int i = 0; i < 30; ++i) {
            for (int j = 0; j < 10000; ++j) {
                if (j % 2 == 1) {
                    disp.dispatch("input", new WeightMessage(3));
                } else {
                    disp.dispatch("input", new WeightMessage(1));
                }
                if (j % 10 == 1) {
                    ThreadUtil.sleep(1);
                }
            }
        }
        group.list();

        ThreadUtil.sleep(2000);
        System.out.println("Done.");
        sw.done();
        sw.print();
        disp.shutdown();
        ThreadUtil.sleep(2000);
        group.list();

    }
View Full Code Here

Examples of org.apache.struts2.dispatcher.Dispatcher

    buildCfg();
    // initDispatcher(null);
  }

  protected Dispatcher initDispatcher(Map<String, String> params) {
    Dispatcher du = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params);
    configurationManager = du.getConfigurationManager();
    configuration = configurationManager.getConfiguration();
    container = configuration.getContainer();
    return du;
  }
View Full Code Here

Examples of org.apache.struts2.dispatcher.Dispatcher

public class GaeInitOperations extends InitOperations {

  @Override
  public Dispatcher initDispatcher(HostConfig filterConfig) {
    Dispatcher dispatcher = createDispatcher(filterConfig);
    dispatcher.init();
    return dispatcher;
  }
View Full Code Here

Examples of org.apache.struts2.dispatcher.Dispatcher

  public void init(FilterConfig filterConfig) throws ServletException {
    InitOperations init = new GaeInitOperations();
    try {
      FilterHostConfig config = new FilterHostConfig(filterConfig);
      init.initLogging(config);
      Dispatcher dispatcher = init.initDispatcher(config);

      init.initStaticContentLoader(config, dispatcher);

      prepare = new PrepareOperations(filterConfig.getServletContext(),
          dispatcher);
View Full Code Here

Examples of org.apache.struts2.dispatcher.Dispatcher

    {
        if (params == null)
        {
            params = new HashMap<String, String>();
        }
        Dispatcher dispatcher = new Dispatcher(servletContext, params);
        dispatcher.init();
        Dispatcher.setInstance(dispatcher);
        return dispatcher;
    }
View Full Code Here

Examples of org.apache.synapse.endpoints.dispatch.Dispatcher

            } else {
                Axis2Sender.sendBack(synCtx);
            }
        } else {
            // If this request is related to session affinity endpoints - For client initiated session
            Dispatcher dispatcher =
                    (Dispatcher) synCtx.getProperty(
                            SynapseConstants.PROP_SAL_ENDPOINT_CURRENT_DISPATCHER);
            if (dispatcher != null) {
                if (!dispatcher.isServerInitiatedSession()) {
                    dispatcher.updateSession(synCtx);
                }
            }

            // This is only for stats collection
            synCtx.setProperty(SynapseConstants.SENDING_REQUEST, true);
View Full Code Here

Examples of org.apache.synapse.endpoints.dispatch.Dispatcher

        serializeProperties(dynamicLoadbalanceEndpoint, endpointElement);

        serializeCommonAttributes(endpoint,endpointElement);
       

        Dispatcher dispatcher = dynamicLoadbalanceEndpoint.getDispatcher();
        if (dispatcher != null) {

            OMElement sessionElement = fac.createOMElement("session", SynapseConstants.SYNAPSE_OMNAMESPACE);
            if (dispatcher instanceof SoapSessionDispatcher) {
                sessionElement.addAttribute("type", "soap", null);
            } else if (dispatcher instanceof HttpSessionDispatcher) {
                sessionElement.addAttribute("type", "http", null);
            } else if (dispatcher instanceof SimpleClientSessionDispatcher) {
                sessionElement.addAttribute("type", "simpleClientSession", null);
            } else {
                handleException("invalid session dispatcher : " + dispatcher.getClass().getName());
            }

            long sessionTimeout = dynamicLoadbalanceEndpoint.getSessionTimeout();
            if (sessionTimeout != -1) {
                OMElement sessionTimeoutElement = fac.createOMElement("sessionTimeout",
View Full Code Here

Examples of org.apache.synapse.endpoints.dispatch.Dispatcher

                synapseInMessageContext.setProperty(
                        (String) key, synapseOutMsgCtx.getProperty((String) key));
            }           

            // If this response is related to session affinity endpoints -Server initiated session
            Dispatcher dispatcher =
                    (Dispatcher) synapseOutMsgCtx.getProperty(
                            SynapseConstants.PROP_SAL_ENDPOINT_CURRENT_DISPATCHER);
            if (dispatcher != null && dispatcher.isServerInitiatedSession()) {
                dispatcher.updateSession(synapseInMessageContext);
            }

            StatisticsReporter.reportForAllOnResponseReceived(synapseInMessageContext);
           
            // send the response message through the synapse mediation flow
View Full Code Here

Examples of org.apache.synapse.endpoints.dispatch.Dispatcher

                }

                String type = sessionElement.getAttributeValue(new QName("type"));

                if (type.equalsIgnoreCase("soap")) {
                    Dispatcher soapDispatcher = new SoapSessionDispatcher();
                    loadbalanceEndpoint.setDispatcher(soapDispatcher);

                } else if (type.equalsIgnoreCase("http")) {
                    Dispatcher httpDispatcher = new HttpSessionDispatcher();
                    loadbalanceEndpoint.setDispatcher(httpDispatcher);

                }

                loadbalanceEndpoint.setSessionAffinity(true);
View Full Code Here

Examples of org.apache.synapse.endpoints.dispatch.Dispatcher

            }
           
            String type = sessionElement.getAttributeValue(new QName("type"));

            if (type.equalsIgnoreCase("soap")) {
                Dispatcher soapDispatcher = new SoapSessionDispatcher();
                loadbalanceEndpoint.setDispatcher(soapDispatcher);

            } else if (type.equalsIgnoreCase("http")) {
                Dispatcher httpDispatcher = new HttpSessionDispatcher();
                loadbalanceEndpoint.setDispatcher(httpDispatcher);

            } else if (type.equalsIgnoreCase("simpleClientSession")) {
                Dispatcher csDispatcher = new SimpleClientSessionDispatcher();
                loadbalanceEndpoint.setDispatcher(csDispatcher);
            }
        } else {
            handleException("Session affinity endpoints should " +
                    "have a session element in the configuration.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.