Example usage for org.springframework.core.task SyncTaskExecutor SyncTaskExecutor

List of usage examples for org.springframework.core.task SyncTaskExecutor SyncTaskExecutor

Introduction

In this page you can find the example usage for org.springframework.core.task SyncTaskExecutor SyncTaskExecutor.

Prototype

SyncTaskExecutor

Source Link

Usage

From source file:br.com.valecard.context.event.ChoiceTaskExecutorApplicationEventMulticaster.java

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void multicastEvent(final ApplicationEvent event) {
    Executor executor = getTaskExecutor();
    if (event instanceof RepositoryEvent) {
        executor = new SyncTaskExecutor();
    }/*  ww w.  jav  a2  s.  c  om*/
    for (final ApplicationListener listener : getApplicationListeners(event)) {
        if (executor != null) {
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    listener.onApplicationEvent(event);
                }
            });
        } else {
            listener.onApplicationEvent(event);
        }
    }

}

From source file:com.apress.prospringintegration.concurrency.taskexecutorexample.TaskExecutorExampleConfiguration.java

@Bean
public SyncTaskExecutor syncTaskExecutor() {
    return new SyncTaskExecutor();
}

From source file:de.langmi.spring.batch.examples.basics.purejava.jobruns.PureJavaJobRunTest.java

private void setupBatchInfrastructure() throws Exception {
    // in-memory variants for important bean
    this.transactionManager = new ResourcelessTransactionManager();
    this.jobRepository = new MapJobRepositoryFactoryBean(transactionManager).getJobRepository();

    // setup job launcher
    SimpleJobLauncher simpleJobLauncher = new SimpleJobLauncher();
    // with a SyncTaskExecutor the job is launched within the actual thread
    simpleJobLauncher.setTaskExecutor(new SyncTaskExecutor());
    simpleJobLauncher.setJobRepository(jobRepository);

    this.jobLauncher = simpleJobLauncher;
}

From source file:com.example.configuration.BatchConfiguration.java

@Bean
public JobLauncher jobLauncher() throws Exception {
    SimpleJobLauncher launcher = new SimpleJobLauncher();
    launcher.setJobRepository(getJobRepository());
    launcher.setTaskExecutor(new SyncTaskExecutor());
    return launcher;
}

From source file:burstcoin.jminer.core.CoreConfig.java

/**
 * Task executor./*from w w  w  .j a  v a2  s  .  c  o m*/
 *
 * @return the sync task executor
 */
@Bean(name = "checkTaskExecutor")
public SyncTaskExecutor taskExecutor() {
    return new SyncTaskExecutor();
}

From source file:org.openscada.spring.client.event.ItemEventAdapter.java

public void setExecutor(final TaskExecutor executor) {
    this.executor = executor == null ? new SyncTaskExecutor() : executor;
}

From source file:py.una.pol.karaku.test.configuration.WebServiceTestConfiguration.java

@Bean
Executor executor() {

    return new SyncTaskExecutor();
}

From source file:py.una.pol.karaku.test.configuration.WebServiceTestConfiguration.java

@Bean
public SyncTaskExecutor syncExecutor() {

    return new SyncTaskExecutor();
}

From source file:nu.yona.server.batch.service.BatchTaskService.java

private JobExecution launchImmediatelySynchronously(Job job, JobParameters jobParameters) {
    // ONLY FOR TEST PURPOSES
    return launchImmediately(new SyncTaskExecutor(), job, jobParameters);
}

From source file:py.una.pol.karaku.configuration.KarakuWSClientConfiguration.java

@Bean
public SyncTaskExecutor getSyncExecutor() {

    return new SyncTaskExecutor();
}