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");
|
||||
* 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
|
||||
* (there <i>should</i> only be one anyway...)
|
||||
*/
|
||||
protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method aMethod) {
|
||||
Class<? extends Annotation>[] classesToLookFor = (Class<? extends Annotation>[]) new Class[] {
|
||||
Before.class,
|
||||
Around.class,
|
||||
After.class,
|
||||
AfterReturning.class,
|
||||
AfterThrowing.class,
|
||||
Pointcut.class
|
||||
};
|
||||
@SuppressWarnings("unchecked")
|
||||
protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method method) {
|
||||
Class<? extends Annotation>[] classesToLookFor = new Class[] {
|
||||
Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class, Pointcut.class};
|
||||
for (Class<? extends Annotation> c : classesToLookFor) {
|
||||
AspectJAnnotation foundAnnotation = findAnnotation(aMethod, c);
|
||||
AspectJAnnotation foundAnnotation = findAnnotation(method, c);
|
||||
if (foundAnnotation != null) {
|
||||
return foundAnnotation;
|
||||
}
|
||||
|
|
@ -199,7 +194,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
// come first in the advice declaration.
|
||||
int typeOffset = paramTypes.length - argNames.length;
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = paramTypes[i+typeOffset];
|
||||
ret[i] = paramTypes[i + typeOffset];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -212,7 +207,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
AtAfterReturning,
|
||||
AtAfterThrowing,
|
||||
AtAround
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -265,8 +260,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
|
||||
private String resolveExpression() throws Exception {
|
||||
String expression = null;
|
||||
for (int i = 0; i < EXPRESSION_PROPERTIES.length; i++) {
|
||||
String methodName = EXPRESSION_PROPERTIES[i];
|
||||
for (String methodName : EXPRESSION_PROPERTIES) {
|
||||
Method method;
|
||||
try {
|
||||
method = this.annotation.getClass().getDeclaredMethod(methodName);
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.scheduling.support.DelegatingExceptionProofRunnable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
|
@ -59,12 +57,14 @@ import org.springframework.util.ObjectUtils;
|
|||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
* @see #setPoolSize
|
||||
* @see #setThreadFactory
|
||||
* @see ScheduledExecutorTask
|
||||
* @see java.util.concurrent.ScheduledExecutorService
|
||||
* @see java.util.concurrent.ScheduledThreadPoolExecutor
|
||||
*/
|
||||
public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||
implements FactoryBean<ScheduledExecutorService>, InitializingBean, DisposableBean {
|
||||
implements FactoryBean<ScheduledExecutorService> {
|
||||
|
||||
private int poolSize = 1;
|
||||
|
||||
|
|
@ -144,10 +144,8 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
|
|||
|
||||
/**
|
||||
* Create a new {@link ScheduledExecutorService} instance.
|
||||
* Called by <code>afterPropertiesSet</code>.
|
||||
* <p>The default implementation creates a {@link ScheduledThreadPoolExecutor}.
|
||||
* Can be overridden in subclasses to provide custom
|
||||
* {@link ScheduledExecutorService} instances.
|
||||
* Can be overridden in subclasses to provide custom {@link ScheduledExecutorService} instances.
|
||||
* @param poolSize the specified pool size
|
||||
* @param threadFactory the ThreadFactory 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) {
|
||||
Executor executor = getThreadPoolExecutor();
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue