You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Hadrian Zbarcea (JIRA)" <ji...@apache.org> on 2009/06/24 01:34:35 UTC

[jira] Commented: (CAMEL-1751) Camel causes Tomcat shutdown to hang

    [ https://issues.apache.org/activemq/browse/CAMEL-1751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52422#action_52422 ] 

Hadrian Zbarcea commented on CAMEL-1751:
----------------------------------------

David reported on irc, that the issue is with a leftover Timer thread in AMQ and the dirty hack below solved it.  We should correct this and make sure AMQ stops properly.  David, thanks for spotting the issue and providing the basis for the solution.


{code}
    public void stop() {
        try {
                        camelContext.stop();
			ThreadGroup group = Thread.currentThread().getThreadGroup();
			Thread[] threads = new Thread[group.activeCount()];
			group.enumerate( threads );
			for ( Thread thread : threads ) {
				if ( thread.getName().contains( "ActiveMQ" ) || thread.getName().contains( "Timer" ) ) {
					thread.stop();
				}
			}
        } catch (Exception e) {
            log.error(e);
        }
{code}

> 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.