title: ExecutionContext and Thread safety on Spring Batch
body: <p>I read few articles about that but Iam not sure about my case.</p>
  
  <p>I am using ExecutionContext in order to pass params from Tasklet to Step</p>
  
  <p>I wanna make sure that if I am executing same job instances in parallel using the same steps I wont have concurrency side-effects.</p>
  
  <p>Thats my job:</p>
  
  <pre><code> @Bean
      public Job processFileJob() throws Exception {
          return this.jobs.get("processFileJob").start(downloadFileStep()).next(processSnidFileStep()).build();
  
      }
  
    public Step downloadFileStep() {
          return this.steps.get("downloadFileTaskletStep").tasklet(downloadFileTasklet()).listener(executionContextPromotionListener()).build();
      }
  </code></pre>
  
  <p>I am passing param from downloadFileStep to processSnidFileStep this way:</p>
  
  <pre><code>public class DownloadFileTasklet implements Tasklet, StepExecutionListener {
  ..
        private void downloadFileFromExtractTool(ChunkContext chunkContext, 
      ..
              stepContext.put("totalRecords", totalRecords);
      ..
  }
  </code></pre>
  
  <p>and retrieve the param onto my step this way:</p>
  
  <pre><code> @Bean
      @Scope(value = "step", proxyMode = ScopedProxyMode.INTERFACES)
      public ItemProcessor&lt;MyDTO, MyDTO&gt; processor(@Value("#{jobExecutionContext[totalRecords]}") int totalRecords
                                                              ) {
          return new PushItemProcessor(totalRecords);
      }
  </code></pre>
  
  <p>Now I can see that param successfully inside processor step.</p>
  
  <p>But what if I execute the whole job in parallel having different values for different jobs? any concurrent side effects?</p>
  
  <p>Thank you.
  ray.</p>