public class RepeatOperationsInterceptor
extends java.lang.Object
implements org.aopalliance.intercept.MethodInterceptor
MethodInterceptor
that can be used to automatically repeat calls to
a method on a service. The injected RepeatOperations
is used to
control the completion of the loop. Independent of the completion policy in
the RepeatOperations
the loop will repeat until the target method
returns null or false. Be careful when injecting a bespoke
RepeatOperations
that the loop will actually terminate, because the
default policy for a vanilla RepeatTemplate
will never complete if
the return type of the target method is void (the value returned is always
not-null, representing the Void.TYPE
).Constructor and Description |
---|
RepeatOperationsInterceptor() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
Invoke the proceeding method call repeatedly, according to the properties
of the injected
RepeatOperations . |
void |
setRepeatOperations(RepeatOperations batchTempate)
Setter for the
RepeatOperations . |
public void setRepeatOperations(RepeatOperations batchTempate)
RepeatOperations
.batchTempate
- template to be usedjava.lang.IllegalArgumentException
- if the argument is null.public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable
RepeatOperations
.invoke
in interface org.aopalliance.intercept.MethodInterceptor
java.lang.Throwable
MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)