Rename AsyncConfigurer#get{+Async}Executor

This commit is contained in:
Chris Beams 2011-05-07 09:32:03 +00:00
parent 358cbf4301
commit 7e398f101c
4 changed files with 7 additions and 5 deletions

View File

@ -68,6 +68,6 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
} }
AsyncConfigurer configurer = configurers.iterator().next(); AsyncConfigurer configurer = configurers.iterator().next();
this.executor = configurer.getExecutor(); this.executor = configurer.getAsyncExecutor();
} }
} }

View File

@ -36,6 +36,6 @@ public interface AsyncConfigurer {
* The {@link Executor} instance to be used when processing async * The {@link Executor} instance to be used when processing async
* method invocations. * method invocations.
*/ */
Executor getExecutor(); Executor getAsyncExecutor();
} }

View File

@ -23,6 +23,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.context.config.AdviceMode; import org.springframework.context.config.AdviceMode;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
@ -52,7 +53,7 @@ import org.springframework.core.Ordered;
* SimpleAsyncTaskExecutor} will be used to process async method invocations. To * SimpleAsyncTaskExecutor} will be used to process async method invocations. To
* customize this behavior, implement {@link AsyncConfigurer} and * customize this behavior, implement {@link AsyncConfigurer} and
* provide your own {@link java.util.concurrent.Executor Executor} through the * provide your own {@link java.util.concurrent.Executor Executor} through the
* {@link AsyncConfigurer#getExecutor() getExecutor()} method. * {@link AsyncConfigurer#getAsyncExecutor() getExecutor()} method.
* *
* <pre class="code"> * <pre class="code">
* &#064;Configuration * &#064;Configuration
@ -64,7 +65,8 @@ import org.springframework.core.Ordered;
* return new MyAsyncBean(); * return new MyAsyncBean();
* } * }
* *
* public Executor getExecutor() { * &#064;Override
* public Executor getAsyncExecutor() {
* ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); * ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
* executor.setThreadNamePrefix("Custom-"); * executor.setThreadNamePrefix("Custom-");
* executor.initialize(); * executor.initialize();

View File

@ -200,7 +200,7 @@ public class EnableAsyncTests {
return new AsyncBean(); return new AsyncBean();
} }
public Executor getExecutor() { public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setThreadNamePrefix("Custom-"); executor.setThreadNamePrefix("Custom-");
executor.initialize(); executor.initialize();