public synchronized void warmUp() throws Exception {
    if (endpointDone.compareAndSet(false, true)) {
      // endpoints should only be started once as they can be reused on other routes
      // and whatnot, thus their lifecycle is to start once, and only to stop when Camel shutdown
      for (Route route : routes) {
        // ensure endpoint is started first (before the route services, such as the consumer)
        ServiceHelper.startService(route.getEndpoint());
      }
    }

    if (warmUpDone.compareAndSet(false, true)) {

      for (Route route : routes) {
        // warm up the route first
        route.warmUp();

        LOG.debug("Starting services on route: {}", route.getId());
        List<Service> services = route.getServices();

        // callback that we are staring these services
        route.onStartingServices(services);

        // gather list of services to start as we need to start child services as well
        Set<Service> list = new LinkedHashSet<Service>();
        for (Service service : services) {
          list.addAll(ServiceHelper.getChildServices(service));
        }

        // split into consumers and child services as we need to start the consumers
        // afterwards to avoid them being active while the others start
        List<Service> childServices = new ArrayList<Service>();
        for (Service service : list) {

          // inject the route
          if (service instanceof RouteAware) {
            ((RouteAware) service).setRoute(route);
          }

          if (service instanceof Consumer) {
            inputs.put(route, (Consumer) service);
          } else {
            childServices.add(service);
          }
        }
        startChildService(route, childServices);

        // fire event
        EventHelper.notifyRouteAdded(camelContext, route);
      }

      // ensure lifecycle strategy is invoked which among others enlist the route in JMX
      for (LifecycleStrategy strategy : camelContext.getLifecycleStrategies()) {
        strategy.onRoutesAdd(routes);
      }

      // add routes to camel context
      camelContext.addRouteCollection(routes);
    }
  }
 /** Gather all child services */
 private Set<Service> gatherChildServices(Route route, boolean includeErrorHandler) {
   // gather list of services to stop as we need to start child services as well
   List<Service> services = new ArrayList<Service>();
   services.addAll(route.getServices());
   // also get route scoped services
   doGetRouteScopedServices(services, route);
   Set<Service> list = new LinkedHashSet<Service>();
   for (Service service : services) {
     list.addAll(ServiceHelper.getChildServices(service));
   }
   if (includeErrorHandler) {
     // also get route scoped error handler (which must be done last)
     doGetRouteScopedErrorHandler(list, route);
   }
   Set<Service> answer = new LinkedHashSet<Service>();
   answer.addAll(list);
   return answer;
 }