Tabnine Logo
JobExecutionListener
Code IndexAdd Tabnine to your IDE (free)

How to use
JobExecutionListener
in
org.springframework.batch.core

Best Java code snippets using org.springframework.batch.core.JobExecutionListener (Showing top 18 results out of 315)

origin: spring-projects/spring-batch

@Test
public void testInterruptWithListener() throws Exception {
  step1.setProcessException(new JobInterruptedException("job interrupted!"));
  JobExecutionListener listener = mock(JobExecutionListener.class);
  listener.beforeJob(jobExecution);
  listener.afterJob(jobExecution);
  job.setJobExecutionListeners(new JobExecutionListener[] { listener });
  job.execute(jobExecution);
  assertEquals(BatchStatus.STOPPED, jobExecution.getStatus());
}
origin: spring-projects/spring-batch

/**
 * Call the registered listeners in reverse order, respecting and
 * prioritising those that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#afterJob(org.springframework.batch.core.JobExecution)
 */
@Override
public void afterJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.reverse(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.afterJob(jobExecution);
  }
}
origin: spring-projects/spring-batch

/**
 * Call the registered listeners in order, respecting and prioritising those
 * that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#beforeJob(org.springframework.batch.core.JobExecution)
 */
@Override
public void beforeJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.iterator(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.beforeJob(jobExecution);
  }
}
origin: spring-projects/spring-batch

@Test
public void testEmptySignatureNamedMethod() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @SuppressWarnings("unused")
    public void aMethod() {
      executed = true;
    }
  };
  factoryBean.setDelegate(delegate);
  Map<String, String> metaDataMap = new HashMap<>();
  metaDataMap.put(AFTER_JOB.getPropertyName(), "aMethod");
  factoryBean.setMetaDataMap(metaDataMap);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  listener.afterJob(new JobExecution(1L));
  assertTrue(delegate.isExecuted());
}
origin: org.springframework.batch/spring-batch-core

/**
 * Call the registered listeners in order, respecting and prioritising those
 * that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#beforeJob(org.springframework.batch.core.JobExecution)
 */
@Override
public void beforeJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.iterator(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.beforeJob(jobExecution);
  }
}
origin: spring-projects/spring-batch

@Test
public void testWithInterface() throws Exception {
  JobListenerWithInterface delegate = new JobListenerWithInterface();
  factoryBean.setDelegate(delegate);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  JobExecution jobExecution = new JobExecution(11L);
  listener.beforeJob(jobExecution);
  listener.afterJob(jobExecution);
  assertTrue(delegate.beforeJobCalled);
  assertTrue(delegate.afterJobCalled);
}
origin: spring-projects/spring-batch

@Test
public void testRightSignatureNamedMethod() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @SuppressWarnings("unused")
    public void aMethod(JobExecution jobExecution) {
      executed = true;
      assertEquals(new Long(25), jobExecution.getId());
    }
  };
  factoryBean.setDelegate(delegate);
  Map<String, String> metaDataMap = new HashMap<>();
  metaDataMap.put(AFTER_JOB.getPropertyName(), "aMethod");
  factoryBean.setMetaDataMap(metaDataMap);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  listener.afterJob(new JobExecution(25L));
  assertTrue(delegate.isExecuted());
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

/**
 * Call the registered listeners in order, respecting and prioritising those
 * that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#beforeJob(org.springframework.batch.core.JobExecution)
 */
@Override
public void beforeJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.iterator(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.beforeJob(jobExecution);
  }
}
origin: spring-projects/spring-batch

@Test
public void testWithAnnotations() throws Exception {
  AnnotatedTestClass delegate = new AnnotatedTestClass();
  factoryBean.setDelegate(delegate);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  JobExecution jobExecution = new JobExecution(11L);
  listener.beforeJob(jobExecution);
  listener.afterJob(jobExecution);
  assertTrue(delegate.beforeJobCalled);
  assertTrue(delegate.afterJobCalled);
}
origin: spring-projects/spring-batch

@Test
public void testFactoryMethod() throws Exception {
  JobListenerWithInterface delegate = new JobListenerWithInterface();
  Object listener = JobListenerFactoryBean.getListener(delegate);
  assertTrue(listener instanceof JobExecutionListener);
  ((JobExecutionListener) listener).afterJob(new JobExecution(11L));
  assertTrue(delegate.afterJobCalled);
}
origin: org.springframework.batch/org.springframework.batch.core

/**
 * Call the registered listeners in order, respecting and prioritising those
 * that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#beforeJob(org.springframework.batch.core.JobExecution)
 */
public void beforeJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.iterator(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.beforeJob(jobExecution);
  }
}
origin: spring-projects/spring-batch

@Test
public void testEmptySignatureAnnotation() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @AfterJob
    public void aMethod() {
      executed = true;
    }
  };
  factoryBean.setDelegate(delegate);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  listener.afterJob(new JobExecution(1L));
  assertTrue(delegate.isExecuted());
}
origin: apache/servicemix-bundles

/**
 * Call the registered listeners in order, respecting and prioritising those
 * that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#beforeJob(org.springframework.batch.core.JobExecution)
 */
@Override
public void beforeJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.iterator(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.beforeJob(jobExecution);
  }
}
origin: spring-projects/spring-batch

@Test
public void testRightSignatureAnnotation() {
  AbstractTestComponent delegate = new AbstractTestComponent() {
    @AfterJob
    public void aMethod(JobExecution jobExecution) {
      executed = true;
      assertEquals(new Long(25), jobExecution.getId());
    }
  };
  factoryBean.setDelegate(delegate);
  JobExecutionListener listener = (JobExecutionListener) factoryBean.getObject();
  listener.afterJob(new JobExecution(25L));
  assertTrue(delegate.isExecuted());
}
origin: org.springframework.batch/spring-batch-core

/**
 * Call the registered listeners in reverse order, respecting and
 * prioritising those that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#afterJob(org.springframework.batch.core.JobExecution)
 */
@Override
public void afterJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.reverse(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.afterJob(jobExecution);
  }
}
origin: org.springframework.batch/org.springframework.batch.core

/**
 * Call the registered listeners in reverse order, respecting and
 * prioritising those that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#afterJob(org.springframework.batch.core.JobExecution)
 */
public void afterJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.reverse(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.afterJob(jobExecution);
  }
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

/**
 * Call the registered listeners in reverse order, respecting and
 * prioritising those that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#afterJob(org.springframework.batch.core.JobExecution)
 */
@Override
public void afterJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.reverse(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.afterJob(jobExecution);
  }
}
origin: apache/servicemix-bundles

/**
 * Call the registered listeners in reverse order, respecting and
 * prioritising those that implement {@link Ordered}.
 * @see org.springframework.batch.core.JobExecutionListener#afterJob(org.springframework.batch.core.JobExecution)
 */
@Override
public void afterJob(JobExecution jobExecution) {
  for (Iterator<JobExecutionListener> iterator = listeners.reverse(); iterator.hasNext();) {
    JobExecutionListener listener = iterator.next();
    listener.afterJob(jobExecution);
  }
}
org.springframework.batch.coreJobExecutionListener

Javadoc

Provide callbacks at specific points in the lifecycle of a Job. Implementations can be stateful if they are careful to either ensure thread safety, or to use one instance of a listener per job, assuming that job instances themselves are not used by more than one thread.

Most used methods

  • afterJob
    Callback after completion of a job. Called after both both successful and failed executions. To perf
  • beforeJob
    Callback before a job executes.

Popular in Java

  • Reactive rest calls using spring rest template
  • compareTo (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • JTextField (javax.swing)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top Sublime Text 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