[ https://issues.apache.org/activemq/browse/CAMEL-1751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52491#action_52491 ]
Tom Wilczak commented on CAMEL-1751: ------------------------------------ Update: if we add daemon=true to the remote broker url, this allows most of the threads that were causing tomcat to hang to be shutdown gracefully. However there is still one timer thread created at line 51 of org.apache.camel.processor.DeadLetterChannel that this parameter does not affect. I believe initializing this timer with isDaemon=true would resolve the hang, but I do not know what else would be impacted by this change. > Camel causes Tomcat shutdown to hang > ------------------------------------ > > Key: CAMEL-1751 > URL: https://issues.apache.org/activemq/browse/CAMEL-1751 > Project: Apache Camel > Issue Type: Bug > Affects Versions: 2.0-M1 > Environment: reproduceable on windows and linux > Reporter: david durham > Assignee: Hadrian Zbarcea > Fix For: 2.0.0 > > > issue is that if I execute DefaultCamelContext().start(), > the tomcat shutdown process will hang. > Here's my spring config. I have the following for 'inbound' return queues. > <bean id="returnQueues" class="com.ReturnedQueueRouteBuilder" > lazy-init="false" init-method="init" destroy-method="stop"> > <property name="routes"> > <map> > <entry key="${a.returnQueue.name}"> > <bean class="com.ReturnedAProcessor"> > <property name="x" ref="y" /> > </bean> > </entry> > <entry key="${b.returnQueue.name}"> > <bean class="com.ReturnedBProcessor"> > <property name="x" ref="y /> > </bean> > </entry> > </map> > </property> > <property name="camelContext" ref="camelContext" /> > <property name="activeMQName" value="${queue.activeMQInstance}" /> > <property name="remoteAddress" value="${queue.remoteAddress}" /> > </bean> > <bean id="camelContext" class="org.apache.camel.impl.DefaultCamelContext" /> > ReturnQueueRouteBuilder looks like: > public class ReturnedQueueRouteBuilder extends RouteBuilder { > ... > public void init() { > camelContext.addComponent(activeMQName.trim(), > ActiveMQComponent.activeMQComponent(remoteAddress.trim())); > try { > camelContext.addRoutes(this); > camelContext.start(); > } catch (Exception e) { > log.error(e); > } > } > public void stop() { > try { > camelContext.stop(); > } catch (Exception e) { > log.error(e); > } > } > @Override > public void configure() throws Exception { > for (Map.Entry<String, Processor> route : routes.entrySet()) { > from(route.getKey()).process(route.getValue()); > } > } > I also see the following stack trace on tomcat shutdown, but I do not think > this is directly the cause. > Exception in thread "InactivityMonitor WriteCheck" > java.lang.NoClassDefFoundError: > org/apache/activemq/transport/InactivityMonitor$3 > at > org.apache.activemq.transport.InactivityMonitor.writeCheck(InactivityMonitor.java:128) > at > org.apache.activemq.transport.InactivityMonitor$2.run(InactivityMonitor.java:103) > at > org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33) > at java.util.TimerThread.mainLoop(Timer.java:512) > at java.util.TimerThread.run(Timer.java:462) > Caused by: java.lang.ClassNotFoundException: > org.apache.activemq.transport.InactivityMonitor$3 > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387) > at > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) > ... 5 more -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.