使用JMSListener的Spring应用程序没有关闭

时间:2015-11-07 18:57:28

标签: java spring tomcat spring-jms

我在Tomcat上运行了一个Spring应用程序。 当我试图关闭它时,它似乎没有这样做。

以下是intellij的截图: enter image description here

以下是我的代码:

@Service
public class QueueMsgConsumer
{

    @JmsListener(destination = Keys.QUEUE_NAME)
    public void processMsg(TextMessage message)
    {
        //do stuff
    }
}

似乎使用@JmsListener启动一个非守护程序线程,当tomcat想要关闭时它不会停止。

关闭我的申请的正确方法是什么?

更新

虽然添加ThreadPoolTaskExecutor' with 'setDaemon(true)确实导致一分钟左右的最终关闭,但它似乎仍然不优雅。开启跟踪'级别记录我看到了:

11:46:04,190  INFO localhost-startStop-1 support.DefaultLifecycleProcessor:356 - Stopping beans in phase 2147483647
11:46:04,191 DEBUG localhost-startStop-1 support.DefaultLifecycleProcessor:226 - Asking bean 'org.springframework.jms.config.internalJmsListenerEndpointRegistry' of type [class org.springframework.jms.config.JmsListenerEndpointRegistry] to stop
11:46:34,197  WARN localhost-startStop-1 support.DefaultLifecycleProcessor:373 - Failed to shut down 1 bean with phase value 2147483647 within timeout of 30000: [org.springframework.jms.config.internalJmsListenerEndpointRegistry]

1 个答案:

答案 0 :(得分:0)

SPR-14233已在Spring Core 4.2.6中修复

相关问题