类 AsyncAnnotationBeanPostProcessor
- 所有已实现的接口:
AopInfrastructureBean,Aware,BeanClassLoaderAware,BeanFactoryAware,BeanPostProcessor,InitializationBeanPostProcessor,cn.taketoday.core.Ordered,Serializable
Async annotation at class or
method-level by adding a corresponding AsyncAnnotationAdvisor to the
exposed proxy (either an existing AOP proxy or a newly generated proxy that
implements all of the target's interfaces).
The TaskExecutor responsible for the asynchronous execution may
be provided as well as the annotation type that indicates a method should be
invoked asynchronously. If no annotation type is specified, this post-
processor will detect both @Async annotation as well
as the EJB 3.1 jakarta.ejb.Asynchronous annotation.
For methods having a void return type, any exception thrown
during the asynchronous method invocation cannot be accessed by the
caller. An AsyncUncaughtExceptionHandler can be specified to handle
these cases.
Note: The underlying async advisor applies before existing advisors by default, in order to switch to async execution as early as possible in the invocation chain.
- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher, Juergen Hoeller, Stephane Nicoll
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final StringThe default name of theTaskExecutorbean to pick up: "taskExecutor".从类继承的字段 cn.taketoday.aop.framework.AbstractAdvisingBeanPostProcessor
advisor, beforeExistingAdvisors从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidconfigure(Supplier<Executor> executor, Supplier<AsyncUncaughtExceptionHandler> exceptionHandler) Configure this post-processor with the given executor and exception handler suppliers, applying the corresponding default if a supplier is not resolvable.voidsetAsyncAnnotationType(Class<? extends Annotation> asyncAnnotationType) Set the 'async' annotation type to be detected at either class or method level.voidsetBeanFactory(BeanFactory beanFactory) voidsetExceptionHandler(AsyncUncaughtExceptionHandler exceptionHandler) Set theAsyncUncaughtExceptionHandlerto use to handle uncaught exceptions thrown by asynchronous method executions.voidsetExecutor(Executor executor) Set theExecutorto use when invoking methods asynchronously.从类继承的方法 cn.taketoday.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor
prepareProxyFactory从类继承的方法 cn.taketoday.aop.framework.AbstractAdvisingBeanPostProcessor
customizeProxyFactory, isEligible, isEligible, postProcessAfterInitialization, postProcessBeforeInitialization, setBeforeExistingAdvisors从类继承的方法 cn.taketoday.aop.framework.ProxyProcessorSupport
evaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoader从类继承的方法 cn.taketoday.aop.framework.ProxyConfig
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toString
-
字段详细资料
-
DEFAULT_TASK_EXECUTOR_BEAN_NAME
The default name of theTaskExecutorbean to pick up: "taskExecutor".Note that the initial lookup happens by type; this is just the fallback in case of multiple executor beans found in the context.
-
-
构造器详细资料
-
AsyncAnnotationBeanPostProcessor
public AsyncAnnotationBeanPostProcessor()
-
-
方法详细资料
-
configure
public void configure(@Nullable Supplier<Executor> executor, @Nullable Supplier<AsyncUncaughtExceptionHandler> exceptionHandler) Configure this post-processor with the given executor and exception handler suppliers, applying the corresponding default if a supplier is not resolvable. -
setExecutor
Set theExecutorto use when invoking methods asynchronously.If not specified, default executor resolution will apply: searching for a unique
TaskExecutorbean in the context, or for anExecutorbean named "taskExecutor" otherwise. If neither of the two is resolvable, a local default executor will be created within the interceptor. -
setExceptionHandler
Set theAsyncUncaughtExceptionHandlerto use to handle uncaught exceptions thrown by asynchronous method executions. -
setAsyncAnnotationType
Set the 'async' annotation type to be detected at either class or method level. By default, both theAsyncannotation and the EJB 3.1jakarta.ejb.Asynchronousannotation will be detected.This setter property exists so that developers can provide their own (non-specific) annotation type to indicate that a method (or all methods of a given class) should be invoked asynchronously.
- 参数:
asyncAnnotationType- the desired annotation type
-
setBeanFactory
-