Tabnine Logo
PartitionStep
Code IndexAdd Tabnine to your IDE (free)

How to use
PartitionStep
in
org.springframework.batch.core.partition.support

Best Java code snippets using org.springframework.batch.core.partition.support.PartitionStep (Showing top 12 results out of 315)

origin: spring-projects/spring-batch

public Step build() {
  PartitionStep step = new PartitionStep();
  step.setName(getName());
  super.enhance(step);
    step.setPartitionHandler(partitionHandler);
    step.setPartitionHandler(partitionHandler);
    step.setStepExecutionSplitter(splitter);
    splitter.setStepName(name);
    this.splitter = splitter;
    step.setStepExecutionSplitter(splitter);
    step.setStepExecutionAggregator(aggregator);
    step.afterPropertiesSet();
origin: spring-projects/spring-batch

@Before
public void setUp() throws Exception {
  MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
  jobRepository = factory.getObject();
  step.setJobRepository(jobRepository);
  step.setName("partitioned");
}
origin: spring-projects/spring-batch

@Test
public void testStepAggregator() throws Exception {
  step.setStepExecutionAggregator(new DefaultStepExecutionAggregator() {
    @Override
    public void aggregate(StepExecution result, Collection<StepExecution> executions) {
      super.aggregate(result, executions);
      result.getExecutionContext().put("aggregated", true);
    }
  });
  step.setStepExecutionSplitter(new SimpleStepExecutionSplitter(jobRepository, true, step.getName(), new SimplePartitioner()));
  step.setPartitionHandler(new PartitionHandler() {
    @Override
    public Collection<StepExecution> handle(StepExecutionSplitter stepSplitter, StepExecution stepExecution)
        throws Exception {
      return Arrays.asList(stepExecution);
    }
  });
  step.afterPropertiesSet();
  JobExecution jobExecution = jobRepository.createJobExecution("vanillaJob", new JobParameters());
  StepExecution stepExecution = jobExecution.createStepExecution("foo");
  jobRepository.add(stepExecution);
  step.execute(stepExecution);
  assertEquals(true, stepExecution.getExecutionContext().get("aggregated"));
}
origin: org.springframework.batch/org.springframework.batch.core

private void configurePartitionStep(PartitionStep ts) {
  Assert.state(partitioner != null, "A Partitioner must be provided for a partition step");
  Assert.state(step != null, "A Step must be provided for a partition step");
  configureAbstractStep(ts);
  if (partitionHandler != null) {
    ts.setPartitionHandler(partitionHandler);
  }
  else {
    TaskExecutorPartitionHandler partitionHandler = new TaskExecutorPartitionHandler();
    partitionHandler.setStep(step);
    if (taskExecutor == null) {
      taskExecutor = new SyncTaskExecutor();
    }
    partitionHandler.setGridSize(gridSize);
    partitionHandler.setTaskExecutor(taskExecutor);
    ts.setPartitionHandler(partitionHandler);
  }
  SimpleStepExecutionSplitter splitter = new SimpleStepExecutionSplitter(jobRepository, step, partitioner);
  ts.setStepExecutionSplitter(splitter);
}
origin: org.springframework.batch/org.springframework.batch.core

PartitionStep ts = new PartitionStep();
configurePartitionStep(ts);
return ts;
origin: spring-projects/spring-batch

@Test
public void testVanillaStepExecution() throws Exception {
  step.setStepExecutionSplitter(new SimpleStepExecutionSplitter(jobRepository, true, step.getName(), new SimplePartitioner()));
  step.setPartitionHandler(new PartitionHandler() {
    @Override
    public Collection<StepExecution> handle(StepExecutionSplitter stepSplitter, StepExecution stepExecution)
        throws Exception {
      Set<StepExecution> executions = stepSplitter.split(stepExecution, 2);
      for (StepExecution execution : executions) {
        execution.setStatus(BatchStatus.COMPLETED);
        execution.setExitStatus(ExitStatus.COMPLETED);
      }
      return executions;
    }
  });
  step.afterPropertiesSet();
  JobExecution jobExecution = jobRepository.createJobExecution("vanillaJob", new JobParameters());
  StepExecution stepExecution = jobExecution.createStepExecution("foo");
  jobRepository.add(stepExecution);
  step.execute(stepExecution);
  // one master and two workers
  assertEquals(3, stepExecution.getJobExecution().getStepExecutions().size());
  assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

public Step build() {
  PartitionStep step = new PartitionStep();
  step.setName(getName());
  super.enhance(step);
    step.setPartitionHandler(partitionHandler);
    step.setPartitionHandler(partitionHandler);
    step.setStepExecutionSplitter(splitter);
    splitter.setStepName(name);
    this.splitter = splitter;
    step.setStepExecutionSplitter(splitter);
    step.setStepExecutionAggregator(aggregator);
    step.afterPropertiesSet();
origin: spring-projects/spring-batch

@Test
public void testFailedStepExecution() throws Exception {
  step.setStepExecutionSplitter(new SimpleStepExecutionSplitter(jobRepository, true, step.getName(), new SimplePartitioner()));
  step.setPartitionHandler(new PartitionHandler() {
    @Override
    public Collection<StepExecution> handle(StepExecutionSplitter stepSplitter, StepExecution stepExecution)
        throws Exception {
      Set<StepExecution> executions = stepSplitter.split(stepExecution, 2);
      for (StepExecution execution : executions) {
        execution.setStatus(BatchStatus.FAILED);
        execution.setExitStatus(ExitStatus.FAILED);
      }
      return executions;
    }
  });
  step.afterPropertiesSet();
  JobExecution jobExecution = jobRepository.createJobExecution("vanillaJob", new JobParameters());
  StepExecution stepExecution = jobExecution.createStepExecution("foo");
  jobRepository.add(stepExecution);
  step.execute(stepExecution);
  // one master and two workers
  assertEquals(3, stepExecution.getJobExecution().getStepExecutions().size());
  assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
}
origin: org.springframework.batch/spring-batch-core

public Step build() {
  PartitionStep step = new PartitionStep();
  step.setName(getName());
  super.enhance(step);
    step.setPartitionHandler(partitionHandler);
    step.setPartitionHandler(partitionHandler);
    step.setStepExecutionSplitter(splitter);
    splitter.setStepName(name);
    this.splitter = splitter;
    step.setStepExecutionSplitter(splitter);
    step.setStepExecutionAggregator(aggregator);
    step.afterPropertiesSet();
origin: spring-projects/spring-batch

@Test
public void testStoppedStepExecution() throws Exception {
  step.setStepExecutionSplitter(new SimpleStepExecutionSplitter(jobRepository, true, step.getName(), new SimplePartitioner()));
  step.setPartitionHandler(new PartitionHandler() {
    @Override
    public Collection<StepExecution> handle(StepExecutionSplitter stepSplitter, StepExecution stepExecution)
        throws Exception {
      Set<StepExecution> executions = stepSplitter.split(stepExecution, 2);
      for (StepExecution execution : executions) {
        execution.setStatus(BatchStatus.STOPPED);
        execution.setExitStatus(ExitStatus.STOPPED);
      }
      return executions;
    }
  });
  step.afterPropertiesSet();
  JobExecution jobExecution = jobRepository.createJobExecution("vanillaJob", new JobParameters());
  StepExecution stepExecution = jobExecution.createStepExecution("foo");
  jobRepository.add(stepExecution);
  step.execute(stepExecution);
  // one master and two workers
  assertEquals(3, stepExecution.getJobExecution().getStepExecutions().size());
  assertEquals(BatchStatus.STOPPED, stepExecution.getStatus());
}
origin: apache/servicemix-bundles

public Step build() {
  PartitionStep step = new PartitionStep();
  step.setName(getName());
  super.enhance(step);
    step.setPartitionHandler(partitionHandler);
    step.setPartitionHandler(partitionHandler);
    step.setStepExecutionSplitter(splitter);
    splitter.setStepName(name);
    this.splitter = splitter;
    step.setStepExecutionSplitter(splitter);
    step.setStepExecutionAggregator(aggregator);
    step.afterPropertiesSet();
origin: spring-projects/spring-batch

@Test
public void testRestartStepExecution() throws Exception {
  final AtomicBoolean started = new AtomicBoolean(false);
  step.setStepExecutionSplitter(new SimpleStepExecutionSplitter(jobRepository, true, step.getName(), new SimplePartitioner()));
  step.setPartitionHandler(new PartitionHandler() {
    @Override
    public Collection<StepExecution> handle(StepExecutionSplitter stepSplitter, StepExecution stepExecution)
  step.afterPropertiesSet();
  JobExecution jobExecution = jobRepository.createJobExecution("vanillaJob", new JobParameters());
  StepExecution stepExecution = jobExecution.createStepExecution("foo");
  jobRepository.add(stepExecution);
  step.execute(stepExecution);
  jobExecution.setStatus(BatchStatus.FAILED);
  jobExecution.setEndTime(new Date());
  stepExecution = jobExecution.createStepExecution("foo");
  jobRepository.add(stepExecution);
  step.execute(stepExecution);
org.springframework.batch.core.partition.supportPartitionStep

Javadoc

Implementation of Step which partitions the execution and spreads the load using a PartitionHandler.

Most used methods

  • setPartitionHandler
    A PartitionHandler which can send out step executions for remote processing and bring back the resul
  • setStepExecutionSplitter
    Public setter for mandatory property StepExecutionSplitter.
  • <init>
  • afterPropertiesSet
    Assert that mandatory properties are set (stepExecutionSplitter, partitionHandler) and delegate top
  • setName
  • setStepExecutionAggregator
    A StepExecutionAggregator that can aggregate step executions when they come back from the handler. D
  • execute
  • getName
  • setJobRepository

Popular in Java

  • Updating database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • getContentResolver (Context)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now