Kohei Nozaki's blog 

Decisionでフロー制御してみる


Posted on Saturday Feb 15, 2014 at 08:20PM in Technology


フロー制御は、ExitStatusでフロー制御してみるでやったようにBatchletだけでもできるけど、Chunk要素などの後続処理のフロー制御はDecision要素を使うと楽にできそうなので、試してみる

例えば先行のChunk処理でスキップが多すぎる時に、一応ジョブは正常終了しつつも警告メール的なものを送っておくとか、そういうことをやりたい時にはDecisionを使うとよいかもしれない。引数でStepExecution[]が渡ってくるので、先行処理のMetricsを取り出して調べたりすることが楽にできる。

環境・前提条件

仕様を確認する

  • [2]から引いてみる

public interface Decider

A Decider receives control as part of a decision element in a job. It is used to direct execution flow during job processing. It returns an exit status that updates the current job execution's exit status. This exit status value also directs the execution transition based on next, end, stop, fail child elements configured on the same decision element as the decider.

String decide(StepExecution[] executions) throws Exception

The decide method sets a new exit status for a job. It receives an array of StepExecution objects as input. These StepExecution objects represent the execution element that transitions to this decider as follows:

Step

When the transition is from a step, the decide method receives the StepExecution corresponding to the step as input.

Split

When the transition is from a split, the decide method receives a StepExecution from each flow defined to the split as input.

Flow

When the transition is from a flow, the decide method receives a StepExecution corresponding to the last execution element that completed in the flow. This will be a single StepExecution if the last element was a step and multiple StepExecutions if the last element was a split.

Parameters:

executions - specifies the StepExecution(s) of the preceding element.

Returns:

updated job exit status

  • とりあえず上に書かれた3パターンで試してみる

Stepからの遷移の場合

資源はこのへんにまとめて全部ある

資源

仕様

  • 第一レベルの要素は以下
    1. step1 (batchlet step)
    2. step2 (chunk oriented step)
    3. step2decision (decision)
    4. step3_NO_SKIP_FOUND (batchlet step)
    5. step4_SKIP_FOUND (batchlet step)
  • step2でスキップがなかった場合はstep3_NO_SKIP_FOUNDに遷移する
  • step2でスキップがあった場合はstep4_SKIP_FOUNDに遷移する

スキップが無い場合のテストを動かしてみる

ログ

13:53:59,614 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): executions=1
13:53:59,614 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): stepName=step2, stepExecutionId=248
13:53:59,614 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: WRITE_SKIP_COUNT=0
13:53:59,615 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: PROCESS_SKIP_COUNT=0
13:53:59,615 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: WRITE_COUNT=10
13:53:59,615 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: COMMIT_COUNT=4
13:53:59,615 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: READ_SKIP_COUNT=0
13:53:59,615 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: ROLLBACK_COUNT=0
13:53:59,615 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: FILTER_COUNT=0
13:53:59,615 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: READ_COUNT=10
13:53:59,615 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): exitStatus=SKIP_NOT_FOUND
13:53:59,617 FINE  [org.nailedtothex.jbatch.example.decision.NopBatchlet] (batch-batch - 10) step3_NO_SKIP_FOUND

Repository

job_execution
jbatch=# select * from job_execution order by jobexecutionid desc limit 1;
 jobexecutionid | jobinstanceid | version |       createtime       |       starttime        |         endtime         |     lastupdatedtime     | batchstatus |   exitstatus   |     jobparameters     | restartposition 
----------------+---------------+---------+------------------------+------------------------+-------------------------+-------------------------+-------------+----------------+-----------------------+-----------------
            188 |           176 |         | 2014-02-16 13:53:59.41 | 2014-02-16 13:53:59.41 | 2014-02-16 13:53:59.619 | 2014-02-16 13:53:59.619 | COMPLETED   | SKIP_NOT_FOUND | itemReaderFailAt = -1+| 
                |               |         |                        |                        |                         |                         |             |                | divide = 2           +| 
                |               |         |                        |                        |                         |                         |             |                |                       | 
(1 row)
step_execution
jbatch=# select * from step_execution where jobexecutionid in (188) order by jobexecutionid, stepexecutionid;
 stepexecutionid | jobexecutionid | version |      stepname       |        starttime        |         endtime         | batchstatus | exitstatus | executionexception | persistentuserdata | readcount | writecount | commitcount | rollbackcount | readskipcount | processskipcount | filtercount | writeskipcount |                                                                         readercheckpointinfo                                                                         |                                                                         writercheckpointinfo                                                                         
-----------------+----------------+---------+---------------------+-------------------------+-------------------------+-------------+------------+--------------------+--------------------+-----------+------------+-------------+---------------+---------------+------------------+-------------+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------
             247 |            188 |         | step1               | 2014-02-16 13:53:59.412 | 2014-02-16 13:53:59.453 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                                                                                                                                                                      | 
             248 |            188 |         | step2               | 2014-02-16 13:53:59.46  | 2014-02-16 13:53:59.61  | COMPLETED   | COMPLETED  |                    |                    |        10 |         10 |           4 |             0 |             0 |                0 |           0 |              0 | \xaced0005737200116a6176612e6c616e672e496e746567657212e2a0a4f781873802000149000576616c7565787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b02000078700000000a | \xaced0005737200116a6176612e6c616e672e496e746567657212e2a0a4f781873802000149000576616c7565787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b020000787000000004
             249 |            188 |         | step3_NO_SKIP_FOUND | 2014-02-16 13:53:59.615 | 2014-02-16 13:53:59.617 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                                                                                                                                                                      | 
(3 rows)

jbatch=# 

スキップが有る場合のテストを動かしてみる

ログ

13:55:00,761 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): executions=1
13:55:00,761 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): stepName=step2, stepExecutionId=251
13:55:00,761 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): metric: WRITE_SKIP_COUNT=0
13:55:00,761 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): metric: PROCESS_SKIP_COUNT=0
13:55:00,761 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): metric: WRITE_COUNT=9
13:55:00,761 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): metric: COMMIT_COUNT=4
13:55:00,762 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): metric: READ_SKIP_COUNT=1
13:55:00,762 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): metric: ROLLBACK_COUNT=0
13:55:00,762 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): metric: FILTER_COUNT=0
13:55:00,762 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): metric: READ_COUNT=9
13:55:00,762 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 5) decide(): exitStatus=SKIP_FOUND
13:55:00,763 FINE  [org.nailedtothex.jbatch.example.decision.NopBatchlet] (batch-batch - 5) step4_SKIP_FOUND

Repository

job_execution
jbatch=# select * from job_execution order by jobexecutionid desc limit 1;
 jobexecutionid | jobinstanceid | version |       createtime        |        starttime        |         endtime         |     lastupdatedtime     | batchstatus | exitstatus |    jobparameters     | restartposition 
----------------+---------------+---------+-------------------------+-------------------------+-------------------------+-------------------------+-------------+------------+----------------------+-----------------
            189 |           177 |         | 2014-02-16 13:55:00.639 | 2014-02-16 13:55:00.639 | 2014-02-16 13:55:00.765 | 2014-02-16 13:55:00.765 | COMPLETED   | SKIP_FOUND | itemReaderFailAt = 5+| 
                |               |         |                         |                         |                         |                         |             |            | divide = 2          +| 
                |               |         |                         |                         |                         |                         |             |            |                      | 
(1 row)
step_execution
jbatch=# select * from step_execution where jobexecutionid in (189) order by jobexecutionid, stepexecutionid;
 stepexecutionid | jobexecutionid | version |     stepname     |        starttime        |         endtime         | batchstatus | exitstatus | executionexception | persistentuserdata | readcount | writecount | commitcount | rollbackcount | readskipcount | processskipcount | filtercount | writeskipcount |                                                                         readercheckpointinfo                                                                         |                                                                         writercheckpointinfo                                                                         
-----------------+----------------+---------+------------------+-------------------------+-------------------------+-------------+------------+--------------------+--------------------+-----------+------------+-------------+---------------+---------------+------------------+-------------+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------
             250 |            189 |         | step1            | 2014-02-16 13:55:00.641 | 2014-02-16 13:55:00.642 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                                                                                                                                                                      | 
             251 |            189 |         | step2            | 2014-02-16 13:55:00.644 | 2014-02-16 13:55:00.758 | COMPLETED   | COMPLETED  |                    |                    |         9 |          9 |           4 |             0 |             1 |                0 |           0 |              0 | \xaced0005737200116a6176612e6c616e672e496e746567657212e2a0a4f781873802000149000576616c7565787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b02000078700000000a | \xaced0005737200116a6176612e6c616e672e496e746567657212e2a0a4f781873802000149000576616c7565787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b020000787000000003
             252 |            189 |         | step4_SKIP_FOUND | 2014-02-16 13:55:00.762 | 2014-02-16 13:55:00.763 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                                                                                                                                                                      | 
(3 rows)

jbatch=# 
  • Decider#decide()に渡されるStepExecutionは、基本的に遷移元Stepのものだけのようだ

Splitからの遷移の場合

資源

仕様

  • 第一レベルの要素は以下
    1. split1 (split)
    2. split1decision (decision)
  • split1の下には同じようなflowが3つある
    • flowの下にはstep (batchlet) が2つ
  • decisionの後の分岐とスキップはもう試したので省略

テストを動かしてみる

ログ

13:42:04,217 FINE  [org.nailedtothex.jbatch.example.decision.NopBatchlet] (batch-batch - 3) flow3-step1
13:42:04,217 FINE  [org.nailedtothex.jbatch.example.decision.NopBatchlet] (batch-batch - 6) flow1-step1
13:42:04,217 FINE  [org.nailedtothex.jbatch.example.decision.NopBatchlet] (batch-batch - 2) flow2-step1
13:42:04,221 FINE  [org.nailedtothex.jbatch.example.split.SleepBatchlet] (batch-batch - 2) entering process(): stepName=flow2-step2, sleepInMills=2,000
13:42:04,221 FINE  [org.nailedtothex.jbatch.example.split.SleepBatchlet] (batch-batch - 3) entering process(): stepName=flow3-step2, sleepInMills=3,000
13:42:04,221 FINE  [org.nailedtothex.jbatch.example.split.SleepBatchlet] (batch-batch - 6) entering process(): stepName=flow1-step2, sleepInMills=1,000
13:42:05,222 FINE  [org.nailedtothex.jbatch.example.split.SleepBatchlet] (batch-batch - 6)  exiting process(): stepName=flow1-step2, sleepInMills=1,000
13:42:06,222 FINE  [org.nailedtothex.jbatch.example.split.SleepBatchlet] (batch-batch - 2)  exiting process(): stepName=flow2-step2, sleepInMills=2,000
13:42:07,222 FINE  [org.nailedtothex.jbatch.example.split.SleepBatchlet] (batch-batch - 3)  exiting process(): stepName=flow3-step2, sleepInMills=3,000
13:42:07,225 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): executions=3
13:42:07,226 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): stepName=flow1-step2, stepExecutionId=243
13:42:07,226 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: WRITE_SKIP_COUNT=0
13:42:07,226 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: PROCESS_SKIP_COUNT=0
13:42:07,226 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: WRITE_COUNT=0
13:42:07,226 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: COMMIT_COUNT=0
13:42:07,226 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: READ_SKIP_COUNT=0
13:42:07,226 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: ROLLBACK_COUNT=0
13:42:07,226 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: FILTER_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: READ_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): stepName=flow2-step2, stepExecutionId=242
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: WRITE_SKIP_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: PROCESS_SKIP_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: WRITE_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: COMMIT_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: READ_SKIP_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: ROLLBACK_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: FILTER_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: READ_COUNT=0
13:42:07,227 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): stepName=flow3-step2, stepExecutionId=244
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: WRITE_SKIP_COUNT=0
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: PROCESS_SKIP_COUNT=0
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: WRITE_COUNT=0
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: COMMIT_COUNT=0
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: READ_SKIP_COUNT=0
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: ROLLBACK_COUNT=0
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: FILTER_COUNT=0
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): metric: READ_COUNT=0
13:42:07,228 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 10) decide(): exitStatus=SKIP_NOT_FOUND
  • 遷移元がSplitの場合、Splitの子Flowの数だけStepExecutionが渡される(Flowの最後の要素のStepExecution)。だから配列なのか。なるほどね

Repository

job_execution
jbatch=# select * from job_execution order by jobexecutionid desc limit 1;
 jobexecutionid | jobinstanceid | version |       createtime        |        starttime        |         endtime         |     lastupdatedtime     | batchstatus |   exitstatus   | jobparameters | restartposition 
----------------+---------------+---------+-------------------------+-------------------------+-------------------------+-------------------------+-------------+----------------+---------------+-----------------
            186 |           174 |         | 2014-02-16 13:42:04.198 | 2014-02-16 13:42:04.198 | 2014-02-16 13:42:07.229 | 2014-02-16 13:42:07.229 | COMPLETED   | SKIP_NOT_FOUND |               | 
(1 row)

jbatch=# 
step_execution
jbatch=# select * from step_execution where jobexecutionid in (186) order by jobexecutionid, stepexecutionid;
 stepexecutionid | jobexecutionid | version |  stepname   |        starttime        |         endtime         | batchstatus | exitstatus | executionexception | persistentuserdata | readcount | writecount | commitcount | rollbackcount | readskipcount | processskipcount | filtercount | writeskipcount | readercheckpointinfo | writercheckpointinfo 
-----------------+----------------+---------+-------------+-------------------------+-------------------------+-------------+------------+--------------------+--------------------+-----------+------------+-------------+---------------+---------------+------------------+-------------+----------------+----------------------+----------------------
             239 |            186 |         | flow1-step1 | 2014-02-16 13:42:04.211 | 2014-02-16 13:42:04.217 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
             240 |            186 |         | flow3-step1 | 2014-02-16 13:42:04.211 | 2014-02-16 13:42:04.217 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
             241 |            186 |         | flow2-step1 | 2014-02-16 13:42:04.211 | 2014-02-16 13:42:04.217 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
             242 |            186 |         | flow2-step2 | 2014-02-16 13:42:04.22  | 2014-02-16 13:42:06.223 | COMPLETED   | SUCCESS    |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
             243 |            186 |         | flow1-step2 | 2014-02-16 13:42:04.22  | 2014-02-16 13:42:05.223 | COMPLETED   | SUCCESS    |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
             244 |            186 |         | flow3-step2 | 2014-02-16 13:42:04.22  | 2014-02-16 13:42:07.222 | COMPLETED   | SUCCESS    |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
(6 rows)

Flowからの遷移の場合

資源

仕様

  • 第一レベルの要素は以下
    1. flow1 (flow)
    2. flowdecision (decision)
  • flow1の下にはstep (batchlet) が2つ

テストを動かしてみる

ログ

13:47:01,234 FINE  [org.nailedtothex.jbatch.example.decision.NopBatchlet] (batch-batch - 6) flow1-step1
13:47:01,237 FINE  [org.nailedtothex.jbatch.example.decision.NopBatchlet] (batch-batch - 6) flow1-step2
13:47:01,239 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): executions=1
13:47:01,239 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): stepName=flow1-step2, stepExecutionId=246
13:47:01,239 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): metric: WRITE_SKIP_COUNT=0
13:47:01,239 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): metric: PROCESS_SKIP_COUNT=0
13:47:01,239 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): metric: WRITE_COUNT=0
13:47:01,240 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): metric: COMMIT_COUNT=0
13:47:01,240 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): metric: READ_SKIP_COUNT=0
13:47:01,240 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): metric: ROLLBACK_COUNT=0
13:47:01,240 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): metric: FILTER_COUNT=0
13:47:01,240 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): metric: READ_COUNT=0
13:47:01,240 FINE  [org.nailedtothex.jbatch.example.decision.MyDecider] (batch-batch - 6) decide(): exitStatus=SKIP_NOT_FOUND

Repository

job_execution
jbatch=# select * from job_execution order by jobexecutionid desc limit 1;
 jobexecutionid | jobinstanceid | version |       createtime        |        starttime        |        endtime         |    lastupdatedtime     | batchstatus |   exitstatus   | jobparameters | restartposition 
----------------+---------------+---------+-------------------------+-------------------------+------------------------+------------------------+-------------+----------------+---------------+-----------------
            187 |           175 |         | 2014-02-16 13:47:01.231 | 2014-02-16 13:47:01.231 | 2014-02-16 13:47:01.24 | 2014-02-16 13:47:01.24 | COMPLETED   | SKIP_NOT_FOUND |               | 
(1 row)
step_execution
jbatch=# select * from step_execution where jobexecutionid in (187) order by jobexecutionid, stepexecutionid;
 stepexecutionid | jobexecutionid | version |  stepname   |        starttime        |         endtime         | batchstatus | exitstatus | executionexception | persistentuserdata | readcount | writecount | commitcount | rollbackcount | readskipcount | processskipcount | filtercount | writeskipcount | readercheckpointinfo | writercheckpointinfo 
-----------------+----------------+---------+-------------+-------------------------+-------------------------+-------------+------------+--------------------+--------------------+-----------+------------+-------------+---------------+---------------+------------------+-------------+----------------+----------------------+----------------------
             245 |            187 |         | flow1-step1 | 2014-02-16 13:47:01.232 | 2014-02-16 13:47:01.234 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
             246 |            187 |         | flow1-step2 | 2014-02-16 13:47:01.236 | 2014-02-16 13:47:01.237 | COMPLETED   | COMPLETED  |                    |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
(2 rows)

jbatch=# 
  • 遷移元がFlowの場合はFlowの一番最後のStepのStepExecutionだけが渡される

備考

  • Decider#decide()に渡されるStepExecutionは以下のようになる
    • 遷移元がStepの場合: 遷移元StepのStepExecution (配列の要素数は1個)
    • 遷移元がSplitの場合: 遷移元Splitの各子Flowの最後のStepのStepExecution (配列の要素数は複数個)
    • 遷移元がFlowの場合: 遷移元Flowの最後のStepのStepExecution (配列の要素数は1個)

参考文献

  1. JSR-000352 Batch Applications for the Java Platform - Final Release
  2. Decider (Java™ EE 7 Specification APIs)



No one has commented yet.

Leave a Comment

HTML Syntax: NOT allowed