Use ProxyMethodInvocation (interface instead of impl)

This commit is contained in:
dsyer
2007-09-28 14:50:35 +00:00
parent c2ea350185
commit 09862eaa97
2 changed files with 7 additions and 11 deletions

View File

@@ -18,11 +18,11 @@ package org.springframework.batch.repeat.aop;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.framework.ReflectiveMethodInvocation;
import org.springframework.aop.ProxyMethodInvocation;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.RepeatCallback;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatOperations;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.exception.RepeatException;
import org.springframework.batch.repeat.support.RepeatTemplate;
import org.springframework.util.Assert;
@@ -71,8 +71,8 @@ public class RepeatOperationsInterceptor implements MethodInterceptor {
try {
MethodInvocation clone = invocation;
if (invocation instanceof ReflectiveMethodInvocation) {
clone = ((ReflectiveMethodInvocation) invocation)
if (invocation instanceof ProxyMethodInvocation) {
clone = ((ProxyMethodInvocation) invocation)
.invocableClone();
} else {
throw new IllegalStateException(

View File

@@ -18,7 +18,7 @@ package org.springframework.batch.retry.aop;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.framework.ReflectiveMethodInvocation;
import org.springframework.aop.ProxyMethodInvocation;
import org.springframework.batch.retry.RetryCallback;
import org.springframework.batch.retry.RetryContext;
import org.springframework.batch.retry.RetryOperations;
@@ -57,16 +57,12 @@ public class RetryOperationsInterceptor implements MethodInterceptor {
* ReflectiveMethodInvocation (but how often would another
* implementation come along?).
*/
MethodInvocation clone = invocation;
if (invocation instanceof ReflectiveMethodInvocation) {
clone = ((ReflectiveMethodInvocation) invocation)
.invocableClone();
if (invocation instanceof ProxyMethodInvocation) {
return ((ProxyMethodInvocation) invocation).invocableClone().proceed();
} else {
throw new IllegalStateException(
"MethodInvocation of the wrong type detected - this should not happen with Spring AOP, so please raise an issue if you see this exception");
}
return clone.proceed();
}
});