Produced by Araxis Merge on 2/7/2017 12:14:06 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | cpss.zip\cpss\src\main\java\gov\va\cpss\job\cbs | CbsJobExecutionListener.java | Wed Feb 1 21:07:30 2017 UTC |
2 | cpss.zip\cpss\src\main\java\gov\va\cpss\job\cbs | CbsJobExecutionListener.java | Fri Feb 3 20:40:11 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 220 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | package go v.va.cpss. job.cbs; | |
2 | ||
3 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _ERROR_KEY ; | |
4 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _FAILURE_K EY; | |
5 | import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _FAILURE_M ESSAGE_KEY ; | |
6 | import sta tic gov.va .cpss.job. cbs.CbsPro cessingCon stants.CBS _AVAILABLE _STATISTIC S_KEY; | |
7 | import sta tic gov.va .cpss.job. cbs.CbsPro cessingCon stants.CBS _AVAILABLE _STATISTIC S_LABEL; | |
8 | import sta tic gov.va .cpss.job. cbs.CbsPro cessingCon stants.CBS _TOTAL_INI TIAL_STATE MENT_COUNT _KEY; | |
9 | import sta tic gov.va .cpss.job. cbs.CbsPro cessingCon stants.CBS _TOTAL_REP LACED_STAT EMENT_COUN T_KEY; | |
10 | ||
11 | import org .apache.lo g4j.Logger ; | |
12 | import org .springfra mework.bat ch.core.Ex itStatus; | |
13 | import org .springfra mework.bat ch.core.Jo bExecution ; | |
14 | import org .springfra mework.bat ch.core.Jo bExecution Listener; | |
15 | ||
16 | import gov .va.cpss.m odel.Proce ssStatus; | |
17 | import gov .va.cpss.s ervice.Cbs Service; | |
18 | ||
19 | /** | |
20 | * Custom JobExecuti onListener used to p rocess cus tom exit s tatus to h andle | |
21 | * errors during Gen erate CBS batch job execution. | |
22 | * | |
23 | * @author DN S P II | |
24 | */ | |
25 | public cla ss CbsJobE xecutionLi stener imp lements Jo bExecution Listener { | |
26 | ||
27 | pr ivate fina l Logger l istenerLog ger; | |
28 | ||
29 | pr ivate CbsS ervice cbs Service; | |
30 | ||
31 | pu blic CbsJo bExecution Listener() { | |
32 | list enerLogger = Logger. getLogger( this.getCl ass().getC anonicalNa me()); | |
33 | } | |
34 | ||
35 | pu blic CbsSe rvice getC bsService( ) { | |
36 | retu rn cbsServ ice; | |
37 | } | |
38 | ||
39 | pu blic void setCbsServ ice(CbsSer vice cbsSe rvice) { | |
40 | this .cbsServic e = cbsSer vice; | |
41 | } | |
42 | ||
43 | @O verride | |
44 | pu blic void beforeJob( JobExecuti on jobExec ution) { | |
45 | list enerLogger .info("Beg inning Job Execution "); | |
46 | ||
47 | // I nitialize written ru nning tota ls. | |
48 | jobE xecution.g etExecutio nContext() .putLong(C BS_TOTAL_I NITIAL_STA TEMENT_COU NT_KEY, 0) ; | |
49 | jobE xecution.g etExecutio nContext() .putLong(C BS_TOTAL_R EPLACED_ST ATEMENT_CO UNT_KEY, 0 ); | |
50 | } | |
51 | ||
52 | @O verride | |
53 | pu blic void afterJob(J obExecutio n jobExecu tion) { | |
54 | ||
55 | list enerLogger .info("Aft er Job"); | |
56 | ||
57 | // S ystem fail ure takes precedence over data error. | |
58 | if ( jobExecuti on.getExec utionConte xt().conta insKey(JOB _FAILURE_K EY)) { | |
59 | ||
60 | final String exi tStatus = jobExecuti on.getExec utionConte xt().getSt ring(JOB_F AILURE_KEY ); | |
61 | ||
62 | if (jo bExecution .getExecut ionContext ().contain sKey(JOB_F AILURE_MES SAGE_KEY)) { | |
63 | ||
64 | final St ring exitM essage = j obExecutio n.getExecu tionContex t().getStr ing(JOB_FA ILURE_MESS AGE_KEY); | |
65 | ||
66 | listener Logger.err or("JobFai lure detec ted, setti ng exit st atus (" + exitStatus + "): " + exitMessa ge); | |
67 | ||
68 | jobExecu tion.setEx itStatus(n ew ExitSta tus(exitSt atus, exit Message)); | |
69 | } else { | |
70 | ||
71 | listener Logger.err or("JobFai lure detec ted, setti ng exit st atus (" + exitStatus + ")"); | |
72 | ||
73 | jobExecu tion.setEx itStatus(n ew ExitSta tus(exitSt atus)); | |
74 | } | |
75 | ||
76 | } el se if (job Execution. getExecuti onContext( ).contains Key(JOB_ER ROR_KEY)) { | |
77 | ||
78 | final String exi tStatus = jobExecuti on.getExec utionConte xt().getSt ring(JOB_E RROR_KEY); | |
79 | ||
80 | listen erLogger.e rror("JobE rror detec ted, setti ng exit st atus (" + exitStatus + ")"); | |
81 | ||
82 | jobExe cution.set ExitStatus (new ExitS tatus(exit Status)); | |
83 | } | |
84 | ||
85 | // S et the com pletion st atistics. | |
86 | setC ompletionS tatistics( jobExecuti on); | |
87 | ||
88 | list enerLogger .info("End ing Job Ex ecution"); | |
89 | } | |
90 | ||
91 | /* * | |
92 | * Set the c ompletion statistics . | |
93 | * | |
94 | * @param jo bExecution | |
95 | * The job execution to append statisitic s to. | |
96 | * / | |
97 | pr ivate void setComple tionStatis tics(JobEx ecution jo bExecution ) { | |
98 | ||
99 | fina l Long ava ilableCoun t = cbsSer vice.getCo untOfState mentsInSta te(Process Status.Sta tus.NEW); | |
100 | ||
101 | if ( availableC ount != nu ll) { | |
102 | jobExe cution.get ExecutionC ontext().p utString(C BS_AVAILAB LE_STATIST ICS_KEY, | |
103 | CBS_AVAILA BLE_STATIS TICS_LABEL + availab leCount); | |
104 | } el se { | |
105 | ||
106 | jobExe cution.get ExecutionC ontext().p utString(C BS_AVAILAB LE_STATIST ICS_KEY, | |
107 | CBS_AVAILA BLE_STATIS TICS_LABEL + "Statis tics Unava ilable"); | |
108 | } | |
109 | } | |
110 | ||
111 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.