Class RepeatOperationsInterceptor
- java.lang.Object
- org.springframework.batch.repeat.interceptor.RepeatOperationsInterceptor
- All Implemented Interfaces:
org.aopalliance.aop.Advice
,org.aopalliance.intercept.Interceptor
,org.aopalliance.intercept.MethodInterceptor
public class RepeatOperationsInterceptor extends java.lang.Object implements org.aopalliance.intercept.MethodInterceptor
AMethodInterceptor
that can be used to automatically repeat calls to a method on a service. The injectedRepeatOperations
is used to control the completion of the loop. Independent of the completion policy in theRepeatOperations
the loop will repeat until the target method returns null or false. Be careful when injecting a bespokeRepeatOperations
that the loop will actually terminate, because the default policy for a vanillaRepeatTemplate
will never complete if the return type of the target method is void (the value returned is always not-null, representing theVoid.TYPE
).- Author:
- Dave Syer
Constructor Summary
Constructors Constructor Description RepeatOperationsInterceptor()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
invoke(org.aopalliance.intercept.MethodInvocation invocation)
Invoke the proceeding method call repeatedly, according to the properties of the injectedRepeatOperations
.void
setRepeatOperations(RepeatOperations batchTemplate)
Setter for theRepeatOperations
.
Method Detail
setRepeatOperations
public void setRepeatOperations(RepeatOperations batchTemplate)
Setter for theRepeatOperations
.- Parameters:
batchTemplate
- template to be used- Throws:
java.lang.IllegalArgumentException
- if the argument is null.
invoke
public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable
Invoke the proceeding method call repeatedly, according to the properties of the injectedRepeatOperations
.- Specified by:
invoke
in interfaceorg.aopalliance.intercept.MethodInterceptor
- Throws:
java.lang.Throwable
- See Also:
MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)