org.springframework.scheduling.annotation

Class AnnotationAsyncExecutionInterceptor

    • Constructor Detail

      • AnnotationAsyncExecutionInterceptor

        public AnnotationAsyncExecutionInterceptor(@Nullable
                                                   java.util.concurrent.Executor defaultExecutor)
        Create a new AnnotationAsyncExecutionInterceptor with the given executor and a simple AsyncUncaughtExceptionHandler.
        Parameters:
        defaultExecutor - the executor to be used by default if no more specific executor has been qualified at the method level using Async.value(); as of 4.2.6, a local executor for this interceptor will be built otherwise
      • AnnotationAsyncExecutionInterceptor

        public AnnotationAsyncExecutionInterceptor(@Nullable
                                                   java.util.concurrent.Executor defaultExecutor,
                                                   AsyncUncaughtExceptionHandler exceptionHandler)
        Create a new AnnotationAsyncExecutionInterceptor with the given executor.
        Parameters:
        defaultExecutor - the executor to be used by default if no more specific executor has been qualified at the method level using Async.value(); as of 4.2.6, a local executor for this interceptor will be built otherwise
        exceptionHandler - the AsyncUncaughtExceptionHandler to use to handle exceptions thrown by asynchronous method executions with void return type
    • Method Detail

      • getExecutorQualifier

        @Nullable
        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 method, specified via Async.value() at the method or declaring class level. If @Async is specified at both the method and class level, the method's #value takes precedence (even if empty string, indicating that the default executor should be used preferentially).
        Overrides:
        getExecutorQualifier in class AsyncExecutionInterceptor
        Parameters:
        method - the method to inspect for executor qualifier metadata
        Returns:
        the qualifier if specified, otherwise empty string indicating that the default executor should be used
        See Also:
        AsyncExecutionAspectSupport.determineAsyncExecutor(Method)