Codota Logo
MulticasterBatchListener.beforeRead
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-batch

/**
 * Surrounds the read call with listener callbacks.
 * @return the item or {@code null} if the data source is exhausted
 * @throws Exception is thrown if error occurs during read.
 */
@Nullable
protected final I doRead() throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    if(item != null) {
      listener.afterRead(item);
    }
    return item;
  }
  catch (Exception e) {
    if (logger.isDebugEnabled()) {
      logger.debug(e.getMessage() + " : " + e.getClass().getName());
    }
    listener.onReadError(e);
    throw e;
  }
}
origin: spring-projects/spring-batch

/**
 * Implements reading as well as any related listener calls required.
 *
 * @param contribution a {@link StepContribution}
 * @param chunk a {@link Chunk}
 * @return an item
 * @throws Exception thrown if error occurs during reading or listener calls.
 */
protected final I doProvide(final StepContribution contribution, final Chunk<I> chunk) throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    if(item != null) {
      listener.afterRead(item);
    } else {
      chunk.setEnd();
    }
    return item;
  }
  catch (Exception e) {
    if (logger.isDebugEnabled()) {
      logger.debug(e.getMessage() + " : " + e.getClass().getName());
    }
    listener.onReadError(e);
    throw e;
  }
}
origin: spring-projects/spring-batch

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

/**
 * Test method for
 * {@link org.springframework.batch.core.listener.MulticasterBatchListener#beforeRead()}
 * .
 */
@Test
public void testBeforeReadFails() {
  error = true;
  try {
    multicast.beforeRead();
    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 testBeforeReadFails_withAnnotatedListener() {
  StepListener listener = StepListenerFactoryBean.getListener(new AnnotationBasedStepListener());
  multicast.register(listener);
  try {
    multicast.beforeRead();
    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 read call with listener callbacks.
 * @return the item or {@code null} if the data source is exhausted
 * @throws Exception is thrown if error occurs during read.
 */
@Nullable
protected final I doRead() throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    if(item != null) {
      listener.afterRead(item);
    }
    return item;
  }
  catch (Exception e) {
    if (logger.isDebugEnabled()) {
      logger.debug(e.getMessage() + " : " + e.getClass().getName());
    }
    listener.onReadError(e);
    throw e;
  }
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

/**
 * Surrounds the read call with listener callbacks.
 * @return item
 * @throws Exception
 */
protected final I doRead() throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    if(item != null) {
      listener.afterRead(item);
    }
    return item;
  }
  catch (Exception e) {
    logger.debug(e.getMessage() + " : " + e.getClass().getName());
    listener.onReadError(e);
    throw e;
  }
}
origin: apache/servicemix-bundles

/**
 * Surrounds the read call with listener callbacks.
 * @return the item or {@code null} if the data source is exhausted
 * @throws Exception is thrown if error occurs during read.
 */
@Nullable
protected final I doRead() throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    if(item != null) {
      listener.afterRead(item);
    }
    return item;
  }
  catch (Exception e) {
    if (logger.isDebugEnabled()) {
      logger.debug(e.getMessage() + " : " + e.getClass().getName());
    }
    listener.onReadError(e);
    throw e;
  }
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

/**
 * Implements reading as well as any related listener calls required.
 *
 * @param contribution a {@link StepContribution}
 * @param chunk a {@link Chunk}
 * @return an item
 * @throws Exception
 */
protected final I doProvide(final StepContribution contribution, final Chunk<I> chunk) throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    if(item != null) {
      listener.afterRead(item);
    } else {
      chunk.setEnd();
    }
    return item;
  }
  catch (Exception e) {
    logger.debug(e.getMessage() + " : " + e.getClass().getName());
    listener.onReadError(e);
    throw e;
  }
}
origin: org.springframework.batch/spring-batch-core

/**
 * Implements reading as well as any related listener calls required.
 *
 * @param contribution a {@link StepContribution}
 * @param chunk a {@link Chunk}
 * @return an item
 * @throws Exception thrown if error occurs during reading or listener calls.
 */
protected final I doProvide(final StepContribution contribution, final Chunk<I> chunk) throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    if(item != null) {
      listener.afterRead(item);
    } else {
      chunk.setEnd();
    }
    return item;
  }
  catch (Exception e) {
    if (logger.isDebugEnabled()) {
      logger.debug(e.getMessage() + " : " + e.getClass().getName());
    }
    listener.onReadError(e);
    throw e;
  }
}
origin: apache/servicemix-bundles

/**
 * Implements reading as well as any related listener calls required.
 *
 * @param contribution a {@link StepContribution}
 * @param chunk a {@link Chunk}
 * @return an item
 * @throws Exception thrown if error occurs during reading or listener calls.
 */
protected final I doProvide(final StepContribution contribution, final Chunk<I> chunk) throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    if(item != null) {
      listener.afterRead(item);
    } else {
      chunk.setEnd();
    }
    return item;
  }
  catch (Exception e) {
    if (logger.isDebugEnabled()) {
      logger.debug(e.getMessage() + " : " + e.getClass().getName());
    }
    listener.onReadError(e);
    throw e;
  }
}
origin: org.springframework.batch/org.springframework.batch.core

/**
 * Surrounds the read call with listener callbacks.
 * @return item
 * @throws Exception
 */
protected final I doRead() throws Exception {
  try {
    listener.beforeRead();
    I item = itemReader.read();
    listener.afterRead(item);
    return item;
  }
  catch (Exception e) {
    listener.onReadError(e);
    throw e;
  }
}
org.springframework.batch.core.listenerMulticasterBatchListenerbeforeRead

Popular methods of MulticasterBatchListener

  • afterProcess
  • afterRead
  • afterWrite
  • beforeProcess
  • beforeWrite
  • 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

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now