0

プロダクション リリースの最終段階で、Java Spring Batch に関する奇妙な問題を発見しました。無限ループに陥ります。

ここに私の設定があります:

<batch:job id="dbasJob" restartable="true">       
    <batch:step id="dbasStep" next="webService">         
        <tasklet>             
            <chunk reader="campaignReader" processor="campaignProcessor" writer="campaignWriter" commit-interval="1" 
                skip-limit="50">

                <skippable-exception-classes>
                    <include class="java.lang.Exception" />
                </skippable-exception-classes>

                <listeners>
                    <listener ref="campaignProcessListener" />
                    <listener ref="campaignSkipListener" />
                </listeners>
            </chunk>         
        </tasklet>
        <batch:listeners>
            <batch:listener ref="promotionListener" />
        </batch:listeners>     
    </batch:step>

レコードの総数は 10 です。したがって、すべての単一レコードが処理された後にコミットが発生します。結果をライターのデータベースに書き込んでいます。

Reader からアイテムを 1 つずつ取得し、処理して DB に書き込みます。

public Campaign read()
{   
    return campaignList.isEmpty() ? null : campaignList.remove(0);
}

public Campaign process(Campaign campaign) throws UnexpectedInputException, ParseException, Exception {

    try 

public void write(List<? extends Campaign> campaignList) throws Exception 
{//...Writing to DB...

実行し続け、データをテーブルに無限に挿入します。

観測は次のとおりです。Commit-Interval < TotalRecords and Skip-Limit > Commit-Interval。

誰かが解決策/回避策を提案した場合、この問題のために製品リリースが行われる時点で私にとって最大の助けになります.

どうもありがとう。

4

1 に答える 1