Tabnine Logo
MulticasterBatchListener.onRetryWriteException
Code IndexAdd Tabnine to your IDE (free)

How to use
onRetryWriteException
method
in
org.springframework.batch.core.listener.MulticasterBatchListener

Best Java code snippets using org.springframework.batch.core.listener.MulticasterBatchListener.onRetryWriteException (Showing top 4 results out of 315)

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: 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;
  }
};
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;
  }
};
org.springframework.batch.core.listenerMulticasterBatchListeneronRetryWriteException

Popular methods of MulticasterBatchListener

  • afterProcess
  • afterRead
  • afterWrite
  • beforeProcess
  • beforeRead
  • beforeWrite
  • onReadError
  • onSkipInProcess
  • onSkipInRead
  • onSkipInWrite
  • onWriteError
  • register
    Register the listener for callbacks on the appropriate interfaces implemented. Any StepListener can
  • onWriteError,
  • register,
  • onProcessError,
  • onRetryProcessException,
  • onRetryReadException,
  • getTargetException,
  • afterChunk,
  • afterStep,
  • beforeChunk

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • onRequestPermissionsResult (Fragment)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Top PhpStorm 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