Package org.springframework.batch.core.step.skip

Examples of org.springframework.batch.core.step.skip.SkipPolicy


    return this;
  }

  protected ChunkProvider<I> createChunkProvider() {

    SkipPolicy readSkipPolicy = createSkipPolicy();
    readSkipPolicy = getFatalExceptionAwareProxy(readSkipPolicy);
    FaultTolerantChunkProvider<I> chunkProvider = new FaultTolerantChunkProvider<I>(getReader(),
        createChunkOperations());
    chunkProvider.setMaxSkipsOnRead(Math.max(getChunkSize(), FaultTolerantChunkProvider.DEFAULT_MAX_SKIPS_ON_READ));
    chunkProvider.setSkipPolicy(readSkipPolicy);
View Full Code Here


    FaultTolerantChunkProcessor<I, O> chunkProcessor = new FaultTolerantChunkProcessor<I, O>(getProcessor(),
        getWriter(), batchRetryTemplate);
    chunkProcessor.setBuffering(!isReaderTransactionalQueue());
    chunkProcessor.setProcessorTransactional(processorTransactional);

    SkipPolicy writeSkipPolicy = createSkipPolicy();
    writeSkipPolicy = getFatalExceptionAwareProxy(writeSkipPolicy);
    chunkProcessor.setWriteSkipPolicy(writeSkipPolicy);
    chunkProcessor.setProcessSkipPolicy(writeSkipPolicy);
    chunkProcessor.setRollbackClassifier(getRollbackClassifier());
    chunkProcessor.setKeyGenerator(keyGenerator);
View Full Code Here

  @Test
  public void testSkipPolicyAttribute() throws Exception {
    @SuppressWarnings("resource")
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/batch/core/configuration/xml/ChunkElementSkipPolicyParserTests-context.xml");
    SkipPolicy policy = getSkipPolicy("s1", context);
    assertTrue(policy.shouldSkip(new NullPointerException(), 0));
    assertTrue(policy.shouldSkip(new ArithmeticException(), 0));
  }
View Full Code Here

  @Test
  public void testSkipPolicyElement() throws Exception {
    @SuppressWarnings("resource")
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/batch/core/configuration/xml/ChunkElementSkipPolicyParserTests-context.xml");
    SkipPolicy policy = getSkipPolicy("s2", context);
    assertFalse(policy.shouldSkip(new NullPointerException(), 0));
    assertTrue(policy.shouldSkip(new ArithmeticException(), 0));
  }
View Full Code Here

  public void testReadSkipWithPolicyExceptionInReader() throws Exception {

    // Should be ignored
    factory.setSkipLimit(0);

    factory.setSkipPolicy(new SkipPolicy() {
      @Override
      public boolean shouldSkip(Throwable t, int skipCount) throws SkipLimitExceededException {
        throw new  RuntimeException("Planned exception in SkipPolicy");
      }
    });
View Full Code Here

  public void testReadSkipWithPolicyExceptionInWriter() throws Exception {

    // Should be ignored
    factory.setSkipLimit(0);

    factory.setSkipPolicy(new SkipPolicy() {
      @Override
      public boolean shouldSkip(Throwable t, int skipCount) throws SkipLimitExceededException {
        throw new  RuntimeException("Planned exception in SkipPolicy");
      }
    });
View Full Code Here

    };

  }

  protected SkipPolicy createSkipPolicy() {
    SkipPolicy skipPolicy = this.skipPolicy;
    Map<Class<? extends Throwable>, Boolean> map = new HashMap<Class<? extends Throwable>, Boolean>(
        skippableExceptionClasses);
    map.put(ForceRollbackForWriteSkipException.class, true);
    LimitCheckingItemSkipPolicy limitCheckingItemSkipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, map);
    if (skipPolicy == null) {
View Full Code Here

   * @return a JSR-352 implementation of the {@link ChunkProcessor}
   * @see JsrFaultTolerantChunkProcessor
   */
  @Override
  protected ChunkProcessor<I> createChunkProcessor() {
    SkipPolicy skipPolicy = getFatalExceptionAwareProxy(createSkipPolicy());
    JsrFaultTolerantChunkProcessor<I, O> chunkProcessor =
        new JsrFaultTolerantChunkProcessor<I, O>(getReader(), getProcessor(),
        getWriter(), createChunkOperations(), createRetryOperations());
    chunkProcessor.setSkipPolicy(skipPolicy);
    chunkProcessor.setRollbackClassifier(getRollbackClassifier());
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.step.skip.SkipPolicy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.