本文整理汇总了Java中org.springframework.batch.repeat.RepeatContext类的典型用法代码示例。如果您正苦于以下问题:Java RepeatContext类的具体用法?Java RepeatContext怎么用?Java RepeatContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RepeatContext类属于org.springframework.batch.repeat包,在下文中一共展示了RepeatContext类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callbackInternalCount
import org.springframework.batch.repeat.RepeatContext; //导入依赖的package包/类
@Test
public void callbackInternalCount() {
RepeatTemplate repeatTemplate = new RepeatTemplate();
repeatTemplate.iterate(new RepeatCallback() {
int count = 0;
@Override
public RepeatStatus doInIteration(RepeatContext context) throws Exception {
return ++count > 5 ? RepeatStatus.FINISHED : RepeatStatus.CONTINUABLE;
}
});
}
示例2: callbackConetxtCount
import org.springframework.batch.repeat.RepeatContext; //导入依赖的package包/类
@Test
public void callbackConetxtCount() {
RepeatTemplate tpl = new RepeatTemplate();
tpl.iterate(new RepeatCallback() {
@Override
public RepeatStatus doInIteration(RepeatContext context) throws Exception {
Integer count = (Integer) context.getAttribute("count");
if (count == null)
count = 0;
count++;
context.setAttribute("count", count);
return count > 5 ? RepeatStatus.FINISHED : RepeatStatus.CONTINUABLE;
}
});
}
示例3: handleException
import org.springframework.batch.repeat.RepeatContext; //导入依赖的package包/类
@Override
public void handleException(RepeatContext rc, Throwable thrwbl) throws Throwable {
rc.setTerminateOnly();
}
示例4: onError
import org.springframework.batch.repeat.RepeatContext; //导入依赖的package包/类
public void onError(RepeatContext sContext, Throwable sThrowable) {
errors.add(sThrowable);
}
示例5: after
import org.springframework.batch.repeat.RepeatContext; //导入依赖的package包/类
public void after(RepeatContext sArg0, RepeatStatus sArg1) {
// Nothing to do
}
示例6: before
import org.springframework.batch.repeat.RepeatContext; //导入依赖的package包/类
public void before(RepeatContext sArg0) {
// Nothing to do
}
示例7: close
import org.springframework.batch.repeat.RepeatContext; //导入依赖的package包/类
public void close(RepeatContext sArg0) {
// Nothing to do
}
示例8: open
import org.springframework.batch.repeat.RepeatContext; //导入依赖的package包/类
public void open(RepeatContext sArg0) {
// Nothing to do
}