From f2f87ff1e03eaece02efdfda2bdfc2fb1c83f692 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 11 Mar 2016 23:52:31 +0100 Subject: [PATCH] Explicit javadoc references to BeanFactory-based default executor lookup Issue: SPR-14030 --- .../AsyncExecutionAspectSupport.java | 6 +++++- .../aspectj/AbstractAsyncExecutionAspect.aj | 18 +++++++++++------- .../aspectj/AnnotationAsyncExecutionAspect.aj | 13 ++++++++++--- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java index 8dce6323299..28917436f08 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java @@ -119,6 +119,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware { * executor will be looked up at invocation time against the enclosing bean factory * @see #getExecutorQualifier(Method) * @see #setBeanFactory(BeanFactory) + * @see #getDefaultExecutor(BeanFactory) */ public void setExecutor(Executor defaultExecutor) { this.defaultExecutor = defaultExecutor; @@ -133,7 +134,10 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware { } /** - * Set the {@link BeanFactory} to be used when looking up executors by qualifier. + * Set the {@link BeanFactory} to be used when looking up executors by qualifier + * or when relying on the default executor lookup algorithm. + * @see #findQualifiedExecutor(BeanFactory, String) + * @see #getDefaultExecutor(BeanFactory) */ @Override public void setBeanFactory(BeanFactory beanFactory) { diff --git a/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AbstractAsyncExecutionAspect.aj b/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AbstractAsyncExecutionAspect.aj index a985f614de1..9efd0a4b93b 100644 --- a/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AbstractAsyncExecutionAspect.aj +++ b/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AbstractAsyncExecutionAspect.aj @@ -17,7 +17,6 @@ package org.springframework.scheduling.aspectj; import java.util.concurrent.Callable; -import java.util.concurrent.Executor; import java.util.concurrent.Future; import org.aspectj.lang.annotation.SuppressAjWarnings; @@ -29,27 +28,32 @@ import org.springframework.core.task.AsyncTaskExecutor; /** * Abstract aspect that routes selected methods asynchronously. * - *

This aspect needs to be injected with an implementation of - * {@link Executor} to activate it for a specific thread pool. - * Otherwise it will simply delegate all calls synchronously. + *

This aspect needs to be injected with an implementation of a task-oriented + * {@link java.util.concurrent.Executor} to activate it for a specific thread pool, + * or with a {@link org.springframework.beans.factory.BeanFactory} for default + * executor lookup. Otherwise it will simply delegate all calls synchronously. * * @author Ramnivas Laddad * @author Juergen Hoeller * @author Chris Beams * @author Stephane Nicoll * @since 3.0.5 + * @see #setExecutor + * @see #setBeanFactory + * @see #getDefaultExecutor */ public abstract aspect AbstractAsyncExecutionAspect extends AsyncExecutionAspectSupport { /** - * Create an {@code AnnotationAsyncExecutionAspect} with a {@code null} default - * executor, which should instead be set via {@code #aspectOf} and - * {@link #setExecutor(Executor)}. The same applies for {@link #setExceptionHandler} + * Create an {@code AnnotationAsyncExecutionAspect} with a {@code null} + * default executor, which should instead be set via {@code #aspectOf} and + * {@link #setExecutor}. The same applies for {@link #setExceptionHandler}. */ public AbstractAsyncExecutionAspect() { super(null); } + /** * Apply around advice to methods matching the {@link #asyncMethod()} pointcut, * submit the actual calling of the method to the correct task executor and return diff --git a/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspect.aj b/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspect.aj index 6df1662a19f..e1a1fd97054 100644 --- a/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspect.aj +++ b/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspect.aj @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,9 +33,17 @@ import org.springframework.scheduling.annotation.Async; * on the return type. If, however, a class marked with {@code @Async} contains a method * that violates this constraint, it produces only a warning. * + *

This aspect needs to be injected with an implementation of a task-oriented + * {@link java.util.concurrent.Executor} to activate it for a specific thread pool, + * or with a {@link org.springframework.beans.factory.BeanFactory} for default + * executor lookup. Otherwise it will simply delegate all calls synchronously. + * * @author Ramnivas Laddad * @author Chris Beams * @since 3.0.5 + * @see #setExecutor + * @see #setBeanFactory + * @see #getDefaultExecutor */ public aspect AnnotationAsyncExecutionAspect extends AbstractAsyncExecutionAspect { @@ -74,7 +82,6 @@ public aspect AnnotationAsyncExecutionAspect extends AbstractAsyncExecutionAspec declare warning: execution(!(void || Future+) (@Async *).*(..)): - "Methods in a class marked with @Async that do not return void or Future will " + - "be routed synchronously"; + "Methods in a class marked with @Async that do not return void or Future will be routed synchronously"; }