spring定時任務 的問題


今天突然想到這個執行定時任務是需要花時間的,如果設置的間隔小於任務所需的時間會是什么情況?定時任務是單線程還是多線程的?

哈哈  又是從網上找到的資料,萬能的互聯網。

task:scheduled 配置默認是單線程串行的,如下配置可以配置多線程。

 
        
    <task:scheduler id="scheduler" pool-size="4" />
    <task:scheduled-tasks scheduler="scheduler">
        <task:scheduled ref="pmTask" method="getMinutePm" cron="0 0/1 * * * ?"/>
        <task:scheduled ref="outsidePmTask" method="getOutsidePm" cron="0 30/30 * * * ?"/>
        <task:scheduled ref="pmTask" method="getHourPm" cron="0 0 0/1 * * ? "/>
        <task:scheduled ref="pmTask" method="getDayPm" cron="0 0 0 1/1 * ? "/>
    </task:scheduled-tasks>

參考 : http://www.cnblogs.com/youtianhong/p/6027249.html

           http://blog.csdn.net/loongshawn/article/details/50663393

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM