polishing
This commit is contained in:
parent
df99929e21
commit
dab23a71f9
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2007 the original author or authors.
|
* Copyright 2002-2009 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.
|
||||||
|
|
@ -69,17 +69,12 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||||
* Find and return the first AspectJ annotation on the given method
|
* Find and return the first AspectJ annotation on the given method
|
||||||
* (there <i>should</i> only be one anyway...)
|
* (there <i>should</i> only be one anyway...)
|
||||||
*/
|
*/
|
||||||
protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method aMethod) {
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends Annotation>[] classesToLookFor = (Class<? extends Annotation>[]) new Class[] {
|
protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method method) {
|
||||||
Before.class,
|
Class<? extends Annotation>[] classesToLookFor = new Class[] {
|
||||||
Around.class,
|
Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class, Pointcut.class};
|
||||||
After.class,
|
|
||||||
AfterReturning.class,
|
|
||||||
AfterThrowing.class,
|
|
||||||
Pointcut.class
|
|
||||||
};
|
|
||||||
for (Class<? extends Annotation> c : classesToLookFor) {
|
for (Class<? extends Annotation> c : classesToLookFor) {
|
||||||
AspectJAnnotation foundAnnotation = findAnnotation(aMethod, c);
|
AspectJAnnotation foundAnnotation = findAnnotation(method, c);
|
||||||
if (foundAnnotation != null) {
|
if (foundAnnotation != null) {
|
||||||
return foundAnnotation;
|
return foundAnnotation;
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +194,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||||
// come first in the advice declaration.
|
// come first in the advice declaration.
|
||||||
int typeOffset = paramTypes.length - argNames.length;
|
int typeOffset = paramTypes.length - argNames.length;
|
||||||
for (int i = 0; i < ret.length; i++) {
|
for (int i = 0; i < ret.length; i++) {
|
||||||
ret[i] = paramTypes[i+typeOffset];
|
ret[i] = paramTypes[i + typeOffset];
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +207,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||||
AtAfterReturning,
|
AtAfterReturning,
|
||||||
AtAfterThrowing,
|
AtAfterThrowing,
|
||||||
AtAround
|
AtAround
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -265,8 +260,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||||
|
|
||||||
private String resolveExpression() throws Exception {
|
private String resolveExpression() throws Exception {
|
||||||
String expression = null;
|
String expression = null;
|
||||||
for (int i = 0; i < EXPRESSION_PROPERTIES.length; i++) {
|
for (String methodName : EXPRESSION_PROPERTIES) {
|
||||||
String methodName = EXPRESSION_PROPERTIES[i];
|
|
||||||
Method method;
|
Method method;
|
||||||
try {
|
try {
|
||||||
method = this.annotation.getClass().getDeclaredMethod(methodName);
|
method = this.annotation.getClass().getDeclaredMethod(methodName);
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
|
||||||
import org.springframework.beans.factory.FactoryBean;
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
import org.springframework.scheduling.support.DelegatingExceptionProofRunnable;
|
import org.springframework.scheduling.support.DelegatingExceptionProofRunnable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
@ -59,12 +57,14 @@ import org.springframework.util.ObjectUtils;
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
* @see #setPoolSize
|
||||||
|
* @see #setThreadFactory
|
||||||
* @see ScheduledExecutorTask
|
* @see ScheduledExecutorTask
|
||||||
* @see java.util.concurrent.ScheduledExecutorService
|
* @see java.util.concurrent.ScheduledExecutorService
|
||||||
* @see java.util.concurrent.ScheduledThreadPoolExecutor
|
* @see java.util.concurrent.ScheduledThreadPoolExecutor
|
||||||
*/
|
*/
|
||||||
public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
|
public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||||
implements FactoryBean<ScheduledExecutorService>, InitializingBean, DisposableBean {
|
implements FactoryBean<ScheduledExecutorService> {
|
||||||
|
|
||||||
private int poolSize = 1;
|
private int poolSize = 1;
|
||||||
|
|
||||||
|
|
@ -144,10 +144,8 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link ScheduledExecutorService} instance.
|
* Create a new {@link ScheduledExecutorService} instance.
|
||||||
* Called by <code>afterPropertiesSet</code>.
|
|
||||||
* <p>The default implementation creates a {@link ScheduledThreadPoolExecutor}.
|
* <p>The default implementation creates a {@link ScheduledThreadPoolExecutor}.
|
||||||
* Can be overridden in subclasses to provide custom
|
* Can be overridden in subclasses to provide custom {@link ScheduledExecutorService} instances.
|
||||||
* {@link ScheduledExecutorService} instances.
|
|
||||||
* @param poolSize the specified pool size
|
* @param poolSize the specified pool size
|
||||||
* @param threadFactory the ThreadFactory to use
|
* @param threadFactory the ThreadFactory to use
|
||||||
* @param rejectedExecutionHandler the RejectedExecutionHandler to use
|
* @param rejectedExecutionHandler the RejectedExecutionHandler to use
|
||||||
|
|
|
||||||
|
|
@ -235,12 +235,6 @@ public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of both the JDK 1.5 Executor interface and the Spring
|
|
||||||
* TaskExecutor interface, delegating to the ThreadPoolExecutor instance.
|
|
||||||
* @see java.util.concurrent.Executor#execute(Runnable)
|
|
||||||
* @see org.springframework.core.task.TaskExecutor#execute(Runnable)
|
|
||||||
*/
|
|
||||||
public void execute(Runnable task) {
|
public void execute(Runnable task) {
|
||||||
Executor executor = getThreadPoolExecutor();
|
Executor executor = getThreadPoolExecutor();
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue