protected synchronized void doStop()

in core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringBootCamelContext.java [64:93]


    protected synchronized void doStop() throws Exception {
        var listeners = controller.getMain().getMainListeners();
        if (!listeners.isEmpty()) {
            for (MainListener listener : listeners) {
                listener.beforeStop(controller.getMain());
            }
        }

        // if we are stopping very quickly then its likely because the user may not have either spring-boot-web
        // or enabled Camel's main controller, so lets log a WARN about this.
        long taken = stopWatch.taken();
        if (warnOnEarlyShutdown && taken < 1200) { // give it a bit of slack
            String cp = System.getProperty("java.class.path");
            boolean junit = cp != null && cp.contains("junit-");
            boolean starterWeb = cp != null && cp.contains("spring-boot-starter-web");
            if (!junit && !starterWeb) {
                LOG.warn(
                        "CamelContext has only been running for less than a second. If you intend to run Camel for a longer time "
                                + "then you can set the property camel.springboot.main-run-controller=true in application.properties"
                                + " or add spring-boot-starter-web JAR to the classpath.");
            }
        }
        super.doStop();

        if (!listeners.isEmpty()) {
            for (MainListener listener : listeners) {
                listener.afterStop(controller.getMain());
            }
        }
    }