Tabnine Logo
ChunkMonitor.setChunkSize
Code IndexAdd Tabnine to your IDE (free)

How to use
setChunkSize
method
in
org.springframework.batch.core.step.item.ChunkMonitor

Best Java code snippets using org.springframework.batch.core.step.item.ChunkMonitor.setChunkSize (Showing top 11 results out of 315)

origin: spring-projects/spring-batch

  @Override
  public Object doWithRetry(RetryContext context) throws Exception {
    contextHolder.set(context);
    if (!data.scanning()) {
      chunkMonitor.setChunkSize(inputs.size());
      try {
        doWrite(outputs.getItems());
      }
      catch (Exception e) {
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
        /*
         * If the exception is marked as no-rollback, we need to
         * override that, otherwise there's no way to write the
         * rest of the chunk or to honour the skip listener
         * contract.
         */
        throw new ForceRollbackForWriteSkipException(
            "Force rollback on skippable exception so that skipped item can be located.", e);
      }
      contribution.incrementWriteCount(outputs.size());
    }
    else {
      scan(contribution, inputs, outputs, chunkMonitor, false);
    }
    return null;
  }
};
origin: spring-projects/spring-batch

@Before
public void setUp() {
  monitor.setItemReader(new ItemReader<String>() {
    @Override
    public String read() throws Exception, UnexpectedInputException, ParseException {
      return "" + (count++);
    }
  });
  monitor.registerItemStream(new ItemStreamSupport() {
    @Override
    public void close() {
      super.close();
      closed = true;
    }
  });
  monitor.setChunkSize(CHUNK_SIZE);
}
origin: spring-projects/spring-batch

  @Override
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Object doWithRetry(RetryContext context) throws Exception {
    chunkMonitor.setChunkSize(chunk.size());
    try {
      doPersist(contribution, chunk);
    }
    catch (Exception e) {
      if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) {
        // Per section 9.2.7 of JSR-352, the SkipListener receives all the items within the chunk 						 
        ((MulticasterBatchListener) getListener()).onSkipInWrite(chunk.getItems(), e);
      } else {
        getListener().onRetryWriteException((List<Object>) chunk.getItems(), e);
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
      }
      /*
       * If the exception is marked as no-rollback, we need to
       * override that, otherwise there's no way to write the
       * rest of the chunk or to honour the skip listener
       * contract.
       */
      throw new ForceRollbackForWriteSkipException(
          "Force rollback on skippable exception so that skipped item can be located.", e);
    }
    contribution.incrementWriteCount(chunk.size());
    return null;
  }
};
origin: spring-projects/spring-batch

  @Test
  public void testUpdateWithNoStream() throws Exception {
    monitor = new ChunkMonitor();
    monitor.setItemReader(new ItemReader<String>() {
      @Override
      public String read() throws Exception, UnexpectedInputException, ParseException {
        return "" + (count++);
      }
    });
    monitor.setChunkSize(CHUNK_SIZE);
    monitor.incrementOffset();
    ExecutionContext executionContext = new ExecutionContext();
    monitor.update(executionContext);
    assertEquals(0, executionContext.size());
  }
}
origin: org.springframework.batch/spring-batch-core

  @Override
  public Object doWithRetry(RetryContext context) throws Exception {
    contextHolder.set(context);
    if (!data.scanning()) {
      chunkMonitor.setChunkSize(inputs.size());
      try {
        doWrite(outputs.getItems());
      }
      catch (Exception e) {
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
        /*
         * If the exception is marked as no-rollback, we need to
         * override that, otherwise there's no way to write the
         * rest of the chunk or to honour the skip listener
         * contract.
         */
        throw new ForceRollbackForWriteSkipException(
            "Force rollback on skippable exception so that skipped item can be located.", e);
      }
      contribution.incrementWriteCount(outputs.size());
    }
    else {
      scan(contribution, inputs, outputs, chunkMonitor, false);
    }
    return null;
  }
};
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

  @Override
  public Object doWithRetry(RetryContext context) throws Exception {
    contextHolder.set(context);
    if (!data.scanning()) {
      chunkMonitor.setChunkSize(inputs.size());
      try {
        doWrite(outputs.getItems());
      }
      catch (Exception e) {
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
        /*
         * If the exception is marked as no-rollback, we need to
         * override that, otherwise there's no way to write the
         * rest of the chunk or to honour the skip listener
         * contract.
         */
        throw new ForceRollbackForWriteSkipException(
            "Force rollback on skippable exception so that skipped item can be located.", e);
      }
      contribution.incrementWriteCount(outputs.size());
    }
    else {
      scan(contribution, inputs, outputs, chunkMonitor, false);
    }
    return null;
  }
};
origin: apache/servicemix-bundles

  @Override
  public Object doWithRetry(RetryContext context) throws Exception {
    contextHolder.set(context);
    if (!data.scanning()) {
      chunkMonitor.setChunkSize(inputs.size());
      try {
        doWrite(outputs.getItems());
      }
      catch (Exception e) {
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
        /*
         * If the exception is marked as no-rollback, we need to
         * override that, otherwise there's no way to write the
         * rest of the chunk or to honour the skip listener
         * contract.
         */
        throw new ForceRollbackForWriteSkipException(
            "Force rollback on skippable exception so that skipped item can be located.", e);
      }
      contribution.incrementWriteCount(outputs.size());
    }
    else {
      scan(contribution, inputs, outputs, chunkMonitor, false);
    }
    return null;
  }
};
origin: org.springframework.batch/org.springframework.batch.core

  public Object doWithRetry(RetryContext context) throws Exception {
    if (!inputs.isBusy()) {
      chunkMonitor.setChunkSize(inputs.size());
      try {
        doWrite(outputs.getItems());
      }
      catch (Exception e) {
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
        /*
         * If the exception is marked as no-rollback, we need to
         * override that, otherwise there's no way to write the
         * rest of the chunk or to honour the skip listener
         * contract.
         */
        throw new ForceRollbackForWriteSkipException(
            "Force rollback on skippable exception so that skipped item can be located.", e);
      }
      contribution.incrementWriteCount(outputs.size());
    }
    else {
      scan(contribution, inputs, outputs, chunkMonitor);
    }
    return null;
  }
};
origin: apache/servicemix-bundles

  @Override
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Object doWithRetry(RetryContext context) throws Exception {
    chunkMonitor.setChunkSize(chunk.size());
    try {
      doPersist(contribution, chunk);
    }
    catch (Exception e) {
      if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) {
        // Per section 9.2.7 of JSR-352, the SkipListener receives all the items within the chunk 						 
        ((MulticasterBatchListener) getListener()).onSkipInWrite(chunk.getItems(), e);
      } else {
        getListener().onRetryWriteException((List<Object>) chunk.getItems(), e);
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
      }
      /*
       * If the exception is marked as no-rollback, we need to
       * override that, otherwise there's no way to write the
       * rest of the chunk or to honour the skip listener
       * contract.
       */
      throw new ForceRollbackForWriteSkipException(
          "Force rollback on skippable exception so that skipped item can be located.", e);
    }
    contribution.incrementWriteCount(chunk.size());
    return null;
  }
};
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

  @Override
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Object doWithRetry(RetryContext context) throws Exception {
    chunkMonitor.setChunkSize(chunk.size());
    try {
      doPersist(contribution, chunk);
    }
    catch (Exception e) {
      if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) {
        // Per section 9.2.7 of JSR-352, the SkipListener receives all the items within the chunk 						 
        ((MulticasterBatchListener) getListener()).onSkipInWrite(chunk.getItems(), e);
      } else {
        getListener().onRetryWriteException((List<Object>) chunk.getItems(), e);
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
      }
      /*
       * If the exception is marked as no-rollback, we need to
       * override that, otherwise there's no way to write the
       * rest of the chunk or to honour the skip listener
       * contract.
       */
      throw new ForceRollbackForWriteSkipException(
          "Force rollback on skippable exception so that skipped item can be located.", e);
    }
    contribution.incrementWriteCount(chunk.size());
    return null;
  }
};
origin: org.springframework.batch/spring-batch-core

  @Override
  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Object doWithRetry(RetryContext context) throws Exception {
    chunkMonitor.setChunkSize(chunk.size());
    try {
      doPersist(contribution, chunk);
    }
    catch (Exception e) {
      if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) {
        // Per section 9.2.7 of JSR-352, the SkipListener receives all the items within the chunk 						 
        ((MulticasterBatchListener) getListener()).onSkipInWrite(chunk.getItems(), e);
      } else {
        getListener().onRetryWriteException((List<Object>) chunk.getItems(), e);
        if (rollbackClassifier.classify(e)) {
          throw e;
        }
      }
      /*
       * If the exception is marked as no-rollback, we need to
       * override that, otherwise there's no way to write the
       * rest of the chunk or to honour the skip listener
       * contract.
       */
      throw new ForceRollbackForWriteSkipException(
          "Force rollback on skippable exception so that skipped item can be located.", e);
    }
    contribution.incrementWriteCount(chunk.size());
    return null;
  }
};
org.springframework.batch.core.step.itemChunkMonitorsetChunkSize

Popular methods of ChunkMonitor

  • incrementOffset
  • registerItemStream
  • resetOffset
  • setItemReader
  • getData
  • getExecutionContextKey
  • setExecutionContextName
  • <init>
  • close
  • getOffset
  • open
  • update
  • open,
  • update

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Vim plugins
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