Browse Source

Polishing

pull/493/head
Juergen Hoeller 11 years ago
parent
commit
b0f0d2f289
  1. 4
      spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java
  2. 17
      spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionInterceptor.java
  3. 4
      spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java

4
spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -81,7 +81,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware { @@ -81,7 +81,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
* Set the {@link BeanFactory} to be used when looking up executors by qualifier.
*/
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}

17
spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionInterceptor.java

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

4
spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java

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

Loading…
Cancel
Save