Hi

Just set the shutdown timeout to 1 milli second (or 1 sec) etc. And
just call stop on CamelContext.

And if you extend the CamelTestSupport classes for your unit tests.
There may be a method you can override and return 1 to indiciate 1 sec
timeout.



On Fri, Mar 22, 2013 at 5:23 PM, Chris Wolf <cwolf.a...@gmail.com> wrote:
> I am implementing some unit tests and if things go wrong I just want
> to shutdown ASAP without regard for inconsistent
> states, etc.  There's no easy hook in DefaultShutDownStrategy to do
> that because you need to know the route
> startup order, so I ended up with this convoluted code (that I kick
> off in a separate thread). It doesn't work, BTW.
>
>                     DefaultRouteStartupOrder rsuo = null;
>                     int startOrder = 0;
>                     List<RouteStartupOrder> suo = new
> ArrayList<RouteStartupOrder>();
>                     List<Route> routes = context.getRoutes();
>                     for (Route route : routes) {
>                         List<Service> services = route.getServices();
>                         for (Service service : services) {
>                             if (service instanceof RouteService) {
>                                 rsuo = new
> DefaultRouteStartupOrder(startOrder, route, (RouteService) service);
>                                 suo.add(rsuo);
>                             }
>                         }
>                         startOrder++;
>                     }
>                     ShutdownStrategy sds = context.getShutdownStrategy();
>                     sds.shutdownForced(context, suo);
>
> I know there must be an easier way, but I haven't found such.  Any ideas?
>
> Thanks,
>
> Chris



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to