001/* 002 * Copyright 2002-2014 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.scheduling.annotation; 018 019import java.util.concurrent.Executor; 020 021import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; 022 023/** 024 * Interface to be implemented by @{@link org.springframework.context.annotation.Configuration 025 * Configuration} classes annotated with @{@link EnableAsync} that wish to customize the 026 * {@link Executor} instance used when processing async method invocations or the 027 * {@link AsyncUncaughtExceptionHandler} instance used to process exception thrown from 028 * async method with {@code void} return type. 029 * 030 * <p>Consider using {@link AsyncConfigurerSupport} providing default implementations for 031 * both methods if only one element needs to be customized. Furthermore, backward compatibility 032 * of this interface will be insured in case new customization options are introduced 033 * in the future. 034 * 035 * <p>See @{@link EnableAsync} for usage examples. 036 * 037 * @author Chris Beams 038 * @author Stephane Nicoll 039 * @since 3.1 040 * @see AbstractAsyncConfiguration 041 * @see EnableAsync 042 * @see AsyncConfigurerSupport 043 */ 044public interface AsyncConfigurer { 045 046 /** 047 * The {@link Executor} instance to be used when processing async 048 * method invocations. 049 */ 050 Executor getAsyncExecutor(); 051 052 /** 053 * The {@link AsyncUncaughtExceptionHandler} instance to be used 054 * when an exception is thrown during an asynchronous method execution 055 * with {@code void} return type. 056 */ 057 AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler(); 058 059}