【问题标题】:ImapIdleChannelAdapter task-scheduler threads configurationImapIdleChannelAdapter 任务调度线程配置
【发布时间】:2015-09-22 18:47:28
【问题描述】:

我一直在使用与 Spring 集成的 ImapIdleChannelAdapter 一些.. 并注意到它启动了 10 个任务调度程序线程。

我一直在检查 ImapIdleChannelAdapter 的文档,但无法找到一种方法来配置它在收听电子邮件收件箱时将启动多少线程。

这是我的 Spring 配置:

<int:channel id="receiveChannel" >
    <int:dispatcher task-executor="threadPool" />
</int:channel>
<int-mail:imap-idle-channel-adapter id="imapAdapter"
    store-uri="imaps://#{systemProperties['imaps.encoded.username']}:#{systemProperties['imaps.encoded.password']}@#{systemProperties['imaps.host']}:#{systemProperties['imaps.port']}/INBOX"
    channel="receiveChannel" auto-startup="true" should-delete-messages="false" should-mark-messages-as-read="false"
    java-mail-properties="javaMailProperties">
</int-mail:imap-idle-channel-adapter>

感谢您的帮助。

【问题讨论】:

    标签: java multithreading spring


    【解决方案1】:

    通过设置执行程序中的线程数——它是“threadPool”bean 的配置,而不是 imapAdapter 本身的配置——尽管你可以使用 setSendingTaskExecutor() 和 setTaskScheduler() 进一步配置 imapAdapter 的线程。

    【讨论】:

    • 我不确定你指的是什么......但是这个配置现在创建了两个池一个线程调度程序池和一个由该xml中定义的“threadPool”bean创建的执行器池. “setTaskScheduler”听起来很合适,但如果你能指出我可以通过 XML 完成的文档,那就太好了。谢谢。我也会检查一下。
    猜你喜欢
    • 2018-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-09
    • 2013-06-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多