congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
MulticasterBatchListener.beforeWrite
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: spring-projects/spring-batch

/**
 * Surrounds the actual write call with listener callbacks.
 *
 * @param items list of items to be written.
 * @throws Exception thrown if error occurs.
 */
protected final void doWrite(List<O> items) throws Exception {
  if (itemWriter == null) {
    return;
  }
  try {
    listener.beforeWrite(items);
    writeItems(items);
    doAfterWrite(items);
  }
  catch (Exception e) {
    doOnWriteError(e, items);
    throw e;
  }
}
origin: spring-projects/spring-batch

/**
 * Test method for
 * {@link org.springframework.batch.core.listener.MulticasterBatchListener#beforeWrite(List)}
 * .
 */
@Test
public void testBeforeWrite() {
  multicast.beforeWrite(null);
  assertEquals(1, count);
}
origin: spring-projects/spring-batch

  /**
   * Implements writing and all related listener calls
   *
   * @param contribution a {@link StepContribution}
   * @param chunk a {@link Chunk}
   * @throws Exception thrown if error occurs during the writing portion of the chunking loop.
   */
  protected final void doPersist(final StepContribution contribution, final Chunk<O> chunk) throws Exception {
    try {
      List<O> items = chunk.getItems();
      listener.beforeWrite(items);
      itemWriter.write(items);
      listener.afterWrite(items);
    }
    catch (Exception e) {
      listener.onWriteError(e, chunk.getItems());
      throw e;
    }
  }
}
origin: spring-projects/spring-batch

/**
 * Test method for
 * {@link org.springframework.batch.core.listener.MulticasterBatchListener#beforeWrite(List)}
 * .
 */
@Test
public void testBeforeWriteFails() {
  error = true;
  try {
    multicast.beforeWrite(null);
    fail("Expected StepListenerFailedException");
  }
  catch (StepListenerFailedException e) {
    // expected
    String message = e.getCause().getMessage();
    assertEquals("Wrong message: " + message, "listener error", message);
  }
  assertEquals(1, count);
}
origin: spring-projects/spring-batch

@Test
public void testBeforeWriteFails_withAnnotatedListener() {
  StepListener listener = StepListenerFactoryBean.getListener(new AnnotationBasedStepListener());
  multicast.register(listener);
  try {
    multicast.beforeWrite(null);
    fail("Expected StepListenerFailedException");
  } catch (StepListenerFailedException e) {
    // expected
    Throwable cause = e.getCause();
    String message = cause.getMessage();
    assertTrue(cause instanceof IllegalStateException);
    assertEquals("Wrong message: " + message, "listener error", message);
  }
}
origin: org.springframework.batch/spring-batch-core

/**
 * Surrounds the actual write call with listener callbacks.
 *
 * @param items list of items to be written.
 * @throws Exception thrown if error occurs.
 */
protected final void doWrite(List<O> items) throws Exception {
  if (itemWriter == null) {
    return;
  }
  try {
    listener.beforeWrite(items);
    writeItems(items);
    doAfterWrite(items);
  }
  catch (Exception e) {
    doOnWriteError(e, items);
    throw e;
  }
}
origin: apache/servicemix-bundles

/**
 * Surrounds the actual write call with listener callbacks.
 *
 * @param items list of items to be written.
 * @throws Exception thrown if error occurs.
 */
protected final void doWrite(List<O> items) throws Exception {
  if (itemWriter == null) {
    return;
  }
  try {
    listener.beforeWrite(items);
    writeItems(items);
    doAfterWrite(items);
  }
  catch (Exception e) {
    doOnWriteError(e, items);
    throw e;
  }
}
origin: org.springframework.batch/org.springframework.batch.core

/**
 * Surrounds the actual write call with listener callbacks.
 * 
 * @param items
 * @throws Exception
 */
protected final void doWrite(List<O> items) throws Exception {
  if (itemWriter==null) {
    return;
  }
  try {
    listener.beforeWrite(items);
    writeItems(items);
    doAfterWrite(items);
  }
  catch (Exception e) {
    listener.onWriteError(e, items);
    throw e;
  }
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

/**
 * Surrounds the actual write call with listener callbacks.
 *
 * @param items
 * @throws Exception
 */
protected final void doWrite(List<O> items) throws Exception {
  if (itemWriter == null) {
    return;
  }
  try {
    listener.beforeWrite(items);
    writeItems(items);
    doAfterWrite(items);
  }
  catch (Exception e) {
    doOnWriteError(e, items);
    throw e;
  }
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

  /**
   * Implements writing and all related listener calls
   *
   * @param contribution a {@link StepContribution}
   * @param chunk a {@link Chunk}
   * @throws Exception
   */
  protected final void doPersist(final StepContribution contribution, final Chunk<O> chunk) throws Exception {
    try {
      List<O> items = chunk.getItems();
      listener.beforeWrite(items);
      itemWriter.write(items);
      listener.afterWrite(items);
    }
    catch (Exception e) {
      listener.onWriteError(e, chunk.getItems());
      throw e;
    }
  }
}
origin: apache/servicemix-bundles

  /**
   * Implements writing and all related listener calls
   *
   * @param contribution a {@link StepContribution}
   * @param chunk a {@link Chunk}
   * @throws Exception thrown if error occurs during the writing portion of the chunking loop.
   */
  protected final void doPersist(final StepContribution contribution, final Chunk<O> chunk) throws Exception {
    try {
      List<O> items = chunk.getItems();
      listener.beforeWrite(items);
      itemWriter.write(items);
      listener.afterWrite(items);
    }
    catch (Exception e) {
      listener.onWriteError(e, chunk.getItems());
      throw e;
    }
  }
}
origin: org.springframework.batch/spring-batch-core

  /**
   * Implements writing and all related listener calls
   *
   * @param contribution a {@link StepContribution}
   * @param chunk a {@link Chunk}
   * @throws Exception thrown if error occurs during the writing portion of the chunking loop.
   */
  protected final void doPersist(final StepContribution contribution, final Chunk<O> chunk) throws Exception {
    try {
      List<O> items = chunk.getItems();
      listener.beforeWrite(items);
      itemWriter.write(items);
      listener.afterWrite(items);
    }
    catch (Exception e) {
      listener.onWriteError(e, chunk.getItems());
      throw e;
    }
  }
}
org.springframework.batch.core.listenerMulticasterBatchListenerbeforeWrite

Popular methods of MulticasterBatchListener

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

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Table (org.hibernate.mapping)
    A relational table
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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