Tabnine Logo
TaskExecutorPartitionHandler.createTask
Code IndexAdd Tabnine to your IDE (free)

How to use
createTask
method
in
org.springframework.batch.core.partition.support.TaskExecutorPartitionHandler

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

origin: spring-projects/spring-batch

@Override
protected Set<StepExecution> doHandle(StepExecution masterStepExecution,
                   Set<StepExecution> partitionStepExecutions) throws Exception {
  Assert.notNull(step, "A Step must be provided.");
  final Set<Future<StepExecution>> tasks = new HashSet<>(getGridSize());
  final Set<StepExecution> result = new HashSet<>();
  for (final StepExecution stepExecution : partitionStepExecutions) {
    final FutureTask<StepExecution> task = createTask(step, stepExecution);
    try {
      taskExecutor.execute(task);
      tasks.add(task);
    } catch (TaskRejectedException e) {
      // couldn't execute one of the tasks
      ExitStatus exitStatus = ExitStatus.FAILED
          .addExitDescription("TaskExecutor rejected the task for this step.");
      /*
       * Set the status in case the caller is tracking it through the
       * JobExecution.
       */
      stepExecution.setStatus(BatchStatus.FAILED);
      stepExecution.setExitStatus(exitStatus);
      result.add(stepExecution);
    }
  }
  for (Future<StepExecution> task : tasks) {
    result.add(task.get());
  }
  return result;
}
origin: org.springframework.batch/spring-batch-core

@Override
protected Set<StepExecution> doHandle(StepExecution masterStepExecution,
                   Set<StepExecution> partitionStepExecutions) throws Exception {
  Assert.notNull(step, "A Step must be provided.");
  final Set<Future<StepExecution>> tasks = new HashSet<Future<StepExecution>>(getGridSize());
  final Set<StepExecution> result = new HashSet<StepExecution>();
  for (final StepExecution stepExecution : partitionStepExecutions) {
    final FutureTask<StepExecution> task = createTask(step, stepExecution);
    try {
      taskExecutor.execute(task);
      tasks.add(task);
    } catch (TaskRejectedException e) {
      // couldn't execute one of the tasks
      ExitStatus exitStatus = ExitStatus.FAILED
          .addExitDescription("TaskExecutor rejected the task for this step.");
      /*
       * Set the status in case the caller is tracking it through the
       * JobExecution.
       */
      stepExecution.setStatus(BatchStatus.FAILED);
      stepExecution.setExitStatus(exitStatus);
      result.add(stepExecution);
    }
  }
  for (Future<StepExecution> task : tasks) {
    result.add(task.get());
  }
  return result;
}
origin: apache/servicemix-bundles

@Override
protected Set<StepExecution> doHandle(StepExecution masterStepExecution,
                   Set<StepExecution> partitionStepExecutions) throws Exception {
  Assert.notNull(step, "A Step must be provided.");
  final Set<Future<StepExecution>> tasks = new HashSet<Future<StepExecution>>(getGridSize());
  final Set<StepExecution> result = new HashSet<StepExecution>();
  for (final StepExecution stepExecution : partitionStepExecutions) {
    final FutureTask<StepExecution> task = createTask(step, stepExecution);
    try {
      taskExecutor.execute(task);
      tasks.add(task);
    } catch (TaskRejectedException e) {
      // couldn't execute one of the tasks
      ExitStatus exitStatus = ExitStatus.FAILED
          .addExitDescription("TaskExecutor rejected the task for this step.");
      /*
       * Set the status in case the caller is tracking it through the
       * JobExecution.
       */
      stepExecution.setStatus(BatchStatus.FAILED);
      stepExecution.setExitStatus(exitStatus);
      result.add(stepExecution);
    }
  }
  for (Future<StepExecution> task : tasks) {
    result.add(task.get());
  }
  return result;
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

@Override
protected Set<StepExecution> doHandle(StepExecution masterStepExecution,
                   Set<StepExecution> partitionStepExecutions) throws Exception {
  Assert.notNull(step, "A Step must be provided.");
  final Set<Future<StepExecution>> tasks = new HashSet<Future<StepExecution>>(getGridSize());
  final Set<StepExecution> result = new HashSet<StepExecution>();
  for (final StepExecution stepExecution : partitionStepExecutions) {
    final FutureTask<StepExecution> task = createTask(step, stepExecution);
    try {
      taskExecutor.execute(task);
      tasks.add(task);
    } catch (TaskRejectedException e) {
      // couldn't execute one of the tasks
      ExitStatus exitStatus = ExitStatus.FAILED
          .addExitDescription("TaskExecutor rejected the task for this step.");
      /*
       * Set the status in case the caller is tracking it through the
       * JobExecution.
       */
      stepExecution.setStatus(BatchStatus.FAILED);
      stepExecution.setExitStatus(exitStatus);
      result.add(stepExecution);
    }
  }
  for (Future<StepExecution> task : tasks) {
    result.add(task.get());
  }
  return result;
}
org.springframework.batch.core.partition.supportTaskExecutorPartitionHandlercreateTask

Javadoc

Creates the task executing the given step in the context of the given execution.

Popular methods of TaskExecutorPartitionHandler

  • <init>
  • setGridSize
    Passed to the StepExecutionSplitter in the #handle(StepExecutionSplitter,StepExecution) method, inst
  • setStep
    Setter for the Step that will be used to execute the partitioned StepExecution. This is a regular Sp
  • setTaskExecutor
    Setter for the TaskExecutor that is used to farm out step executions to multiple threads.
  • getGridSize
  • afterPropertiesSet
  • handle

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • setScale (BigDecimal)
  • getSharedPreferences (Context)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • BoxLayout (javax.swing)
  • Top plugins for Android Studio
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