camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rno <romanno...@gmx.at>
Subject Re: MainListenerSupport afterStop is never called (spring.Main)
Date Tue, 29 Dec 2015 08:25:06 GMT
The camel version is as follows: 2.16.1

Shutdown log after JMX "camel"/stop
2015-12-29 09:23:11,727 [Thread-5                 ] INFO 
DefaultShutdownStrategy        -            -            - Graceful shutdown
of 5 routes com
pleted in 0 seconds
2015-12-29 09:23:11,739 [Thread-5                 ] INFO  SpringCamelContext            
-            -            - Apache Camel 2.16.1 (CamelContext
: camel) uptime 15.556 seconds
2015-12-29 09:23:11,739 [Thread-5                 ] INFO  SpringCamelContext            
-            -            - Apache Camel 2.16.1 (CamelContext
: camel) is shutdown in 0.031 seconds

This last part only appears in the log after ctrl+c:
2015-12-29 09:23:35,189 [Thread-0                 ] INFO 
MainSupport$HangupInterceptor  -            -            - Received hang up
- stopping the m
ain instance.
2015-12-29 09:23:35,189 [Thread-0                 ] INFO 
ClassPathXmlApplicationContext -            -            - Closing
org.springframework.conte
xt.support.ClassPathXmlApplicationContext@515f550a: startup date [Tue Dec 29
09:22:50 CET 2015]; root of context hierarchy

My startup code looks like this:
public class MyRouteBuilder extends RouteBuilder {

   // if you want to shutdown the program: main.setDuration(10000); // in ms
   public static void main(String[] args) throws Exception {
       org.apache.camel.spring.Main main = new Main();
       main.addMainListener(new Events());
       main.enableHangupSupport();
       main.run();
   }

   public static class Events extends MainListenerSupport {   

	   // this never gets called! So process hangs, routes stop though
	   // if this gets called you probably do not need this :)
		@Override
		public void afterStop(MainSupport main) {
			System.exit(1);
		}
   }




--
View this message in context: http://camel.465427.n5.nabble.com/MainListenerSupport-afterStop-is-never-called-spring-Main-tp5775458p5775561.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message