|
spring-aop | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.aop.interceptor.AsyncExecutionAspectSupport
org.springframework.aop.interceptor.AsyncExecutionInterceptor
public class AsyncExecutionInterceptor
AOP Alliance MethodInterceptor that processes method invocations
asynchronously, using a given AsyncTaskExecutor.
Typically used with the org.springframework.scheduling.annotation.Async annotation.
In terms of target method signatures, any parameter types are supported.
However, the return type is constrained to either void or
java.util.concurrent.Future. In the latter case, the Future handle
returned from the proxy will be an actual asynchronous Future that can be used
to track the result of the asynchronous method execution. However, since the
target method needs to implement the same signature, it will have to return
a temporary Future handle that just passes the return value through
(like Spring's org.springframework.scheduling.annotation.AsyncResult
or EJB 3.1's javax.ejb.AsyncResult).
As of Spring 3.2 the AnnotationAsyncExecutionInterceptor subclass is
preferred for use due to its support for executor qualification in conjunction with
Spring's @Async annotation.
org.springframework.scheduling.annotation.Async,
org.springframework.scheduling.annotation.AsyncAnnotationAdvisor,
org.springframework.scheduling.annotation.AnnotationAsyncExecutionInterceptor| Field Summary |
|---|
| Fields inherited from interface org.springframework.core.Ordered |
|---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
| Constructor Summary | |
|---|---|
AsyncExecutionInterceptor(java.util.concurrent.Executor executor)
Create a new AsyncExecutionInterceptor. |
|
| Method Summary | |
|---|---|
protected java.lang.String |
getExecutorQualifier(java.lang.reflect.Method method)
Return the qualifier or bean name of the executor to be used when executing the given async method, typically specified in the form of an annotation attribute. |
int |
getOrder()
|
java.lang.Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
Intercept the given method invocation, submit the actual calling of the method to the correct task executor and return immediately to the caller. |
| Methods inherited from class org.springframework.aop.interceptor.AsyncExecutionAspectSupport |
|---|
determineAsyncExecutor, setBeanFactory, setExecutor |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AsyncExecutionInterceptor(java.util.concurrent.Executor executor)
AsyncExecutionInterceptor.
executor - the Executor (typically a Spring AsyncTaskExecutor
or ExecutorService) to delegate to.| Method Detail |
|---|
public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
throws java.lang.Throwable
invoke in interface org.aopalliance.intercept.MethodInterceptorinvocation - the method to intercept and make asynchronous
Future if the original method returns Future; null
otherwise.
java.lang.Throwableprotected java.lang.String getExecutorQualifier(java.lang.reflect.Method method)
null indicates that no specific executor has
been specified and that the default executor
should be used.
This implementation is a no-op for compatibility in Spring 3.2. Subclasses may override to provide support for extracting qualifier information, e.g. via an annotation on the given method.
getExecutorQualifier in class AsyncExecutionAspectSupportmethod - the method to inspect for executor qualifier metadata
nullAsyncExecutionAspectSupport.determineAsyncExecutor(Method)public int getOrder()
getOrder in interface org.springframework.core.Ordered
|
spring-aop | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||