List of usage examples for org.springframework.core.task.support TaskExecutorAdapter TaskExecutorAdapter
public TaskExecutorAdapter(Executor concurrentExecutor)
From source file:com.apress.prospringintegration.concurrency.taskexecutorexample.TaskExecutorExampleConfiguration.java
@Bean public TaskExecutorAdapter taskExecutorAdapter() { return new TaskExecutorAdapter(Executors.newCachedThreadPool()); }
From source file:com.teradata.benchto.driver.TestConfig.java
@Primary @Bean/* w w w. j a v a 2 s . com*/ public AsyncTaskExecutor defaultTaskExecutor() { // MockRestServiceServer expects calls in particular order, // we need to use sync task executor return new TaskExecutorAdapter(MoreExecutors.directExecutor()); }
From source file:net.camelpe.weld.requestcontext.jms.WeldRequestContextInitiatingJmsConfiguration.java
public void setExecutor(final Executor executor) throws IllegalArgumentException { Validate.notNull(executor, "executor"); setTaskExecutor(new TaskExecutorAdapter(executor)); }
From source file:net.camelpe.hornetq.HornetQCamelComponent.java
public void setExecutor(final Executor executor) throws IllegalArgumentException { Validate.notNull(executor, "executor"); getConfiguration().setTaskExecutor(new TaskExecutorAdapter(executor)); }
From source file:dk.clanie.actor.ActorExecutionInterceptor.java
/** * Create a new AsyncExecutionInterceptor. * //from w ww . j ava 2 s.c om * @param asyncExecutor the <code>java.util.concurrent</code> Executor * to delegate to (typically a {@link java.util.concurrent.ExecutorService} */ public ActorExecutionInterceptor(Executor asyncExecutor) { this.executor = new TaskExecutorAdapter(asyncExecutor); }
From source file:com.crossbusiness.resiliency.aspect.AbstractAsyncAspect.java
protected AsyncTaskExecutor getExecutor(Method method, String qualifier) { AsyncTaskExecutor executor = this.executors.get(method); if (executor == null) { Executor executorToUse = this.defaultExecutor; if (qualifier != null && !qualifier.isEmpty()) { try { executorToUse = context.getBean(qualifier, Executor.class); } catch (NoSuchBeanDefinitionException ex) { //NoSuchBeanDefinitionException | NoUniqueBeanDefinitionException log.error("Executor with qualifier: " + qualifier + " Not defined in spring context"); }//from w w w .j av a 2s . c om } if (executorToUse == null) { return null; } executor = (executorToUse instanceof AsyncTaskExecutor ? (AsyncTaskExecutor) executorToUse : new TaskExecutorAdapter(executorToUse)); this.executors.put(method, executor); } return executor; }
From source file:org.springframework.aop.interceptor.AsyncExecutionAspectSupport.java
/** * Determine the specific executor to use when executing the given method. * Should preferably return an {@link AsyncListenableTaskExecutor} implementation. * @return the executor to use (or {@code null}, but just if no default executor is available) *///www.jav a 2 s . c o m @Nullable protected AsyncTaskExecutor determineAsyncExecutor(Method method) { AsyncTaskExecutor executor = this.executors.get(method); if (executor == null) { Executor targetExecutor; String qualifier = getExecutorQualifier(method); if (StringUtils.hasLength(qualifier)) { targetExecutor = findQualifiedExecutor(this.beanFactory, qualifier); } else { targetExecutor = this.defaultExecutor; if (targetExecutor == null) { synchronized (this.executors) { if (this.defaultExecutor == null) { this.defaultExecutor = getDefaultExecutor(this.beanFactory); } targetExecutor = this.defaultExecutor; } } } if (targetExecutor == null) { return null; } executor = (targetExecutor instanceof AsyncListenableTaskExecutor ? (AsyncListenableTaskExecutor) targetExecutor : new TaskExecutorAdapter(targetExecutor)); this.executors.put(method, executor); } return executor; }