From 09862eaa979d812864aef27058310d5648ca2885 Mon Sep 17 00:00:00 2001 From: dsyer Date: Fri, 28 Sep 2007 14:50:35 +0000 Subject: [PATCH] Use ProxyMethodInvocation (interface instead of impl) --- .../batch/repeat/aop/RepeatOperationsInterceptor.java | 8 ++++---- .../batch/retry/aop/RetryOperationsInterceptor.java | 10 +++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/infrastructure/src/main/java/org/springframework/batch/repeat/aop/RepeatOperationsInterceptor.java b/infrastructure/src/main/java/org/springframework/batch/repeat/aop/RepeatOperationsInterceptor.java index 247310e15..b6d13b2a4 100644 --- a/infrastructure/src/main/java/org/springframework/batch/repeat/aop/RepeatOperationsInterceptor.java +++ b/infrastructure/src/main/java/org/springframework/batch/repeat/aop/RepeatOperationsInterceptor.java @@ -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( diff --git a/infrastructure/src/main/java/org/springframework/batch/retry/aop/RetryOperationsInterceptor.java b/infrastructure/src/main/java/org/springframework/batch/retry/aop/RetryOperationsInterceptor.java index 864fca155..e86b992df 100644 --- a/infrastructure/src/main/java/org/springframework/batch/retry/aop/RetryOperationsInterceptor.java +++ b/infrastructure/src/main/java/org/springframework/batch/retry/aop/RetryOperationsInterceptor.java @@ -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(); } });