public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor
Async
annotation. This annotation can be used at the method and type level in
implementation classes as well as in service interfaces.
This advisor detects the EJB 3.1 javax.ejb.Asynchronous
annotation as well, treating it exactly like Spring's own Async
.
Furthermore, a custom async annotation type may get specified through the
"asyncAnnotationType"
property.
PersistenceExceptionTranslationAdvisor
,
Repository
,
DataAccessException
,
PersistenceExceptionTranslator
,
Serialized FormHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
AsyncAnnotationAdvisor()
Create a new ConcurrencyAnnotationBeanPostProcessor for bean-style configuration.
|
AsyncAnnotationAdvisor(Executor executor)
Create a new ConcurrencyAnnotationBeanPostProcessor for the given task executor.
|
Modifier and Type | Method and Description |
---|---|
protected org.aopalliance.aop.Advice |
buildAdvice(Executor executor) |
protected Pointcut |
buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes)
Calculate a pointcut for the given target class, if any.
|
org.aopalliance.aop.Advice |
getAdvice()
Return the advice part of this aspect.
|
Pointcut |
getPointcut()
Get the Pointcut that drives this advisor.
|
void |
setAsyncAnnotationType(Class<? extends Annotation> asyncAnnotationType)
Set the 'async' annotation type.
|
void |
setTaskExecutor(Executor executor)
Specify the task executor to use for asynchronous methods.
|
equals, getOrder, hashCode, isPerInstance, setOrder
public AsyncAnnotationAdvisor()
public AsyncAnnotationAdvisor(Executor executor)
executor
- the task executor to use for asynchronous methodspublic void setTaskExecutor(Executor executor)
public void setAsyncAnnotationType(Class<? extends Annotation> asyncAnnotationType)
The default async annotation type is the Async
annotation, as well
as the EJB 3.1 javax.ejb.Asynchronous
annotation (if present).
This setter property exists so that developers can provide their own (non-Spring-specific) annotation type to indicate that a method is to be executed asynchronously.
asyncAnnotationType
- the desired annotation typepublic org.aopalliance.aop.Advice getAdvice()
Advisor
MethodInterceptor
,
BeforeAdvice
,
ThrowsAdvice
,
AfterReturningAdvice
public Pointcut getPointcut()
PointcutAdvisor
protected org.aopalliance.aop.Advice buildAdvice(Executor executor)
protected Pointcut buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes)
targetClass
- the class to introspectnull
if noneCopyright © 2012. All Rights Reserved.