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.aop.interceptor;
018
019import java.lang.reflect.Method;
020
021/**
022 * A strategy for handling uncaught exceptions thrown from asynchronous methods.
023 *
024 * <p>An asynchronous method usually returns a {@link java.util.concurrent.Future}
025 * instance that gives access to the underlying exception. When the method does
026 * not provide that return type, this handler can be used to managed such
027 * uncaught exceptions.
028 *
029 * @author Stephane Nicoll
030 * @since 4.1
031 */
032public interface AsyncUncaughtExceptionHandler {
033
034        /**
035         * Handle the given uncaught exception thrown from an asynchronous method.
036         * @param ex the exception thrown from the asynchronous method
037         * @param method the asynchronous method
038         * @param params the parameters used to invoked the method
039         */
040        void handleUncaughtException(Throwable ex, Method method, Object... params);
041
042}