Polishing

This commit is contained in:
Juergen Hoeller 2014-05-15 14:39:06 +02:00
parent 0728e32e7f
commit b0f0d2f289
3 changed files with 14 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -81,7 +81,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
* Set the {@link BeanFactory} to be used when looking up executors by qualifier. * Set the {@link BeanFactory} to be used when looking up executors by qualifier.
*/ */
@Override @Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException { public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
} }

View File

@ -72,6 +72,7 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport
private AsyncUncaughtExceptionHandler exceptionHandler; private AsyncUncaughtExceptionHandler exceptionHandler;
/** /**
* Create a new {@code AsyncExecutionInterceptor}. * Create a new {@code AsyncExecutionInterceptor}.
* @param defaultExecutor the {@link Executor} (typically a Spring {@link AsyncTaskExecutor} * @param defaultExecutor the {@link Executor} (typically a Spring {@link AsyncTaskExecutor}
@ -90,6 +91,7 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport
this(defaultExecutor, new SimpleAsyncUncaughtExceptionHandler()); this(defaultExecutor, new SimpleAsyncUncaughtExceptionHandler());
} }
/** /**
* Supply the {@link AsyncUncaughtExceptionHandler} to use to handle exceptions * Supply the {@link AsyncUncaughtExceptionHandler} to use to handle exceptions
* thrown by invoking asynchronous methods with a {@code void} return type. * thrown by invoking asynchronous methods with a {@code void} return type.
@ -98,6 +100,7 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport
this.exceptionHandler = exceptionHandler; this.exceptionHandler = exceptionHandler;
} }
/** /**
* Intercept the given method invocation, submit the actual calling of the method to * Intercept the given method invocation, submit the actual calling of the method to
* the correct task executor and return immediately to the caller. * the correct task executor and return immediately to the caller.
@ -150,7 +153,6 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport
* for all other cases, the exception will not be transmitted back to the client. * for all other cases, the exception will not be transmitted back to the client.
* In that later case, the current {@link AsyncUncaughtExceptionHandler} will be * In that later case, the current {@link AsyncUncaughtExceptionHandler} will be
* used to manage such exception. * used to manage such exception.
*
* @param ex the exception to handle * @param ex the exception to handle
* @param method the method that was invoked * @param method the method that was invoked
* @param params the parameters used to invoke the method * @param params the parameters used to invoke the method
@ -159,13 +161,14 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport
if (method.getReturnType().isAssignableFrom(Future.class)) { if (method.getReturnType().isAssignableFrom(Future.class)) {
ReflectionUtils.rethrowException(ex); ReflectionUtils.rethrowException(ex);
} }
else { // Could not transmit the exception to the caller with default executor else {
// Could not transmit the exception to the caller with default executor
try { try {
exceptionHandler.handleUncaughtException(ex, method, params); this.exceptionHandler.handleUncaughtException(ex, method, params);
} }
catch (Exception e) { catch (Throwable ex2) {
logger.error("exception handler has thrown an unexpected " + logger.error("Exception handler for async method '" + method.toGenericString() +
"exception while invoking '" + method.toGenericString() + "'", e); "' threw unexpected exception itself", ex2);
} }
} }
} }
@ -175,8 +178,8 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport
* Subclasses may override to provide support for extracting qualifier information, * Subclasses may override to provide support for extracting qualifier information,
* e.g. via an annotation on the given method. * e.g. via an annotation on the given method.
* @return always {@code null} * @return always {@code null}
* @see #determineAsyncExecutor(Method)
* @since 3.1.2 * @since 3.1.2
* @see #determineAsyncExecutor(Method)
*/ */
@Override @Override
protected String getExecutorQualifier(Method method) { protected String getExecutorQualifier(Method method) {

View File

@ -147,7 +147,7 @@ public enum SpelMessage {
"The value ''{0}'' cannot be parsed as a long"), "The value ''{0}'' cannot be parsed as a long"),
INVALID_FIRST_OPERAND_FOR_MATCHES_OPERATOR(Kind.ERROR, 1037, INVALID_FIRST_OPERAND_FOR_MATCHES_OPERATOR(Kind.ERROR, 1037,
"First operand to matches operator must be a string. ''{0}'' is not"), "First operand to matches operator must be a string. ''{0}'' is not"),
INVALID_SECOND_OPERAND_FOR_MATCHES_OPERATOR(Kind.ERROR, 1038, INVALID_SECOND_OPERAND_FOR_MATCHES_OPERATOR(Kind.ERROR, 1038,
"Second operand to matches operator must be a string. ''{0}'' is not"), "Second operand to matches operator must be a string. ''{0}'' is not"),
@ -166,7 +166,7 @@ public enum SpelMessage {
"Problem parsing right operand"), "Problem parsing right operand"),
NOT_EXPECTED_TOKEN(Kind.ERROR, 1043, NOT_EXPECTED_TOKEN(Kind.ERROR, 1043,
"Unexpected token. Expected ''{0}'' but was ''{1}''"), "Unexpected token. Expected ''{0}'' but was ''{1}''"),
OOD(Kind.ERROR, 1044, OOD(Kind.ERROR, 1044,
"Unexpectedly ran out of input"), "Unexpectedly ran out of input"),