本文整理匯總了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
}