public static void main()

in apm-agent-plugins/apm-spring-webflux/apm-spring-webflux-testapp/src/main/java/co/elastic/apm/agent/springwebflux/testapp/WebFluxApplication.java [48:106]


    public static void main(String[] args) {
        List<String> arguments = Arrays.asList(args);
        int port = Integer.parseInt(parseOption(arguments, "--port", Integer.toString(DEFAULT_PORT)));
        String server = parseOption(arguments, "--server", "netty");
        int count = Integer.parseInt(parseOption(arguments, "--count", "0"));

        boolean isClient = arguments.contains("--client");
        boolean logEnabled = arguments.contains("--log");

        boolean isBench = arguments.contains("--benchmark");
        boolean waitForKey = arguments.contains("--wait");

        if (isBench) {
            // start the whole server & client
            App app = run(port, server, logEnabled);

            count = Math.max(count, 100); // any smaller benchmark is not meaningful
            try {
                if (waitForKey) {
                    waitForKey();
                }

                // warmup has same duration as benchmark to help having consistent results
                logger.info("warmup requests ({})", count);
                doSampleRequests(app::getClient, count);
                logger.info("warmup complete");

                if (waitForKey) {
                    waitForKey();
                }

                logger.info("start benchmark ({})", count);
                doSampleRequests(app::getClient, count);
                logger.info("benchmark complete");

                if (waitForKey) {
                    waitForKey();
                }


            } finally {
                app.close();
            }
        } else if (isClient) {
            count = Math.max(count, 1);
            doSampleRequests(useFunc -> new GreetingWebClient("localhost", port, useFunc, logEnabled), count);
        } else {

            try (App app = run(port, server, logEnabled)) {
                if (count > 0) {
                    doSampleRequests(useFunc -> new GreetingWebClient("localhost", port, useFunc, logEnabled), count);
                }

                // leave server running
                waitForKey();
            }
        }

    }