44. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 2/7/2017 12:14:07 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.

44.1 Files compared

# Location File Last Modified
1 cpss.zip\cpss\src\main\java\gov\va\cpss\job CbssBaseRetryTasklet.java Wed Feb 1 21:07:26 2017 UTC
2 cpss.zip\cpss\src\main\java\gov\va\cpss\job CbssBaseRetryTasklet.java Fri Feb 3 20:50:17 2017 UTC

44.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 218
Changed 1 2
Inserted 0 0
Removed 0 0

44.3 Comparison options

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

44.4 Active regular expressions

No regular expressions were active.

44.5 Comparison detail

  1   package go v.va.cpss. job;
  2  
  3   import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _FAILURE_K EY;
  4   import sta tic gov.va .cpss.job. CbssJobPro cessingCon stants.JOB _FAILURE_M ESSAGE_KEY ;
  5  
  6   import org .apache.lo g4j.Logger ;
  7   import org .springfra mework.bat ch.core.Ex itStatus;
  8   import org .springfra mework.bat ch.core.St epContribu tion;
  9   import org .springfra mework.bat ch.core.St epExecutio n;
  10   import org .springfra mework.bat ch.core.St epExecutio nListener;
  11   import org .springfra mework.bat ch.core.sc ope.contex t.ChunkCon text;
  12   import org .springfra mework.bat ch.core.st ep.item.Ba tchRetryTe mplate;
  13   import org .springfra mework.bat ch.core.st ep.tasklet .Tasklet;
  14   import org .springfra mework.bat ch.repeat. RepeatStat us;
  15   import org .springfra mework.ret ry.Recover yCallback;
  16   import org .springfra mework.ret ry.RetryCa llback;
  17   import org .springfra mework.ret ry.RetryCo ntext;
  18   import org .springfra mework.ret ry.RetryEx ception;
  19  
  20   /**
  21    * Abstrac t base cla ss that im plements l ogic for a  tasklet t o retry ex ecution.
  22    * 
  23    * @author   D N   
  24    */
  25   public abs tract clas s CbssBase RetryTaskl et impleme nts Taskle t, StepExe cutionList ener {
  26  
  27           pr ivate stat ic final S tring RETR Y_FAILURE_ STATUS = " RETRY ATTE MPTS EXHAU STED";
  28           pr ivate stat ic final S tring RETR Y_FAILURE_ MESSAGE =  "Processin g could no t continue  due to re try constr aints";
  29  
  30           pr otected fi nal Logger  taskletLo gger;
  31  
  32           /*
  33            *  This flag  is used t o indicate  if the pr ocessing w as success ful and no
  34            *  longer ne eds to ret ry.
  35            * /
  36           pr ivate bool ean succes sful = fal se;
  37  
  38           /*
  39            *  The retry  template  that has t he retry a nd backoff  policy co nfiguratio ns.
  40            * /
  41           pr ivate Batc hRetryTemp late batch RetryTempl ate;
  42  
  43           pu blic CbssB aseRetryTa sklet() {
  44                    task letLogger  = Logger.g etLogger(t his.getCla ss().getCa nonicalNam e());
  45           }
  46  
  47           pu blic Batch RetryTempl ate getBat chRetryTem plate() {
  48                    retu rn batchRe tryTemplat e;
  49           }
  50  
  51           pu blic void  setBatchRe tryTemplat e(BatchRet ryTemplate  batchRetr yTemplate)  {
  52                    this .batchRetr yTemplate  = batchRet ryTemplate ;
  53           }
  54  
  55           @O verride
  56           pu blic Repea tStatus ex ecute(Step Contributi on contrib ution, Chu nkContext  chunkConte xt) throws  Exception  {
  57  
  58                    retu rn batchRe tryTemplat e.execute( new RetryC allback<Re peatStatus , RetryExc eption>()  {
  59  
  60                             public  RepeatSta tus doWith Retry(Retr yContext c ontext) th rows Retry Exception  {
  61  
  62                                      // Call  custom log ic impleme nted by su bclass.
  63                                      if (exec uteLogic() ) {
  64                                               successful  = true;
  65                                               return Rep eatStatus. FINISHED;
  66                                      }
  67  
  68                                      taskletL ogger.warn ("Tasklet  could not  continue,  attempting  retry..." );
  69                                      throw ne w RetryExc eption("Ta sklet coul d not cont inue, atte mpting ret ry...");
  70                             }
  71  
  72                    }, n ew Recover yCallback< RepeatStat us>() {
  73  
  74                             @Overr ide
  75                             public  RepeatSta tus recove r(RetryCon text conte xt) throws  Exception  {
  76  
  77                                      taskletL ogger.erro r("Tasklet  could not  start and  exhausted  all retry  attempts" );
  78                                      return R epeatStatu s.FINISHED ;
  79                             }
  80  
  81                    });
  82           }
  83  
  84           @O verride
  85           pu blic void  beforeStep (StepExecu tion stepE xecution)  {
  86                    // I nitialize.
  87                    succ essful = f alse;
  88           }
  89  
  90           @O verride
  91           pu blic ExitS tatus afte rStep(Step Execution  stepExecut ion) {
  92  
  93                    if ( successful ) {
  94                             return  ExitStatu s.COMPLETE D;
  95                    }
  96  
  97                    step Execution. getJobExec ution().ge tExecution Context(). putString( JOB_FAILUR E_KEY, RET RY_FAILURE _STATUS);
  98                    step Execution. getJobExec ution().ge tExecution Context(). putString( JOB_FAILUR E_MESSAGE_ KEY, RETRY _FAILURE_M ESSAGE);
  99                    retu rn ExitSta tus.FAILED ;
  100           }
  101  
  102           /* *
  103            *  Custom lo gic provid ed by impl ementing c lass to re turn true  of tasklet
  104            *  completed  successfu lly and no  longer ne eds to att empt retry .
  105            *  
  106            *  @return B oolean fla g indicati ng if the  logic was  executed s uccessfull y.
  107            * /
  108           ab stract pro tected boo lean execu teLogic();
  109  
  110   }