类 AsyncExecutionInterceptor

java.lang.Object
cn.taketoday.aop.interceptor.AsyncExecutionAspectSupport
cn.taketoday.aop.interceptor.AsyncExecutionInterceptor
所有已实现的接口:
Aware, BeanFactoryAware, Ordered, Advice, Interceptor, MethodInterceptor

public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport implements MethodInterceptor, Ordered
AOP Alliance MethodInterceptor that processes method invocations asynchronously, using a given AsyncTaskExecutor. Typically used with the cn.taketoday.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 cn.taketoday.scheduling.annotation.AsyncResult or EJB's jakarta.ejb.AsyncResult).

When the return type is java.util.concurrent.Future, any exception thrown during the execution can be accessed and managed by the caller. With void return type however, such exceptions cannot be transmitted back. In that case an AsyncUncaughtExceptionHandler can be registered to process such exceptions.

The AnnotationAsyncExecutionInterceptor subclass is preferred for use due to its support for executor qualification in conjunction with @Async annotation.

从以下版本开始:
4.0
作者:
Juergen Hoeller, Chris Beams, Stephane Nicoll
另请参阅:
  • cn.taketoday.scheduling.annotation.Async
  • cn.taketoday.scheduling.annotation.AsyncAnnotationAdvisor
  • cn.taketoday.scheduling.annotation.AnnotationAsyncExecutionInterceptor