Execute the operation on each member of a page of results retrieved through the fetch method. the method will execute until either the maxPages or maxTime limit is reached or until the fetch method returns no more results. Exceptions thrown performing the operation on the item will be swallowed if the swallowException (default true) field is set true.
98 long startTime = System.currentTimeMillis();
99 long executionTime = 0;
102 int exceptionsSwallowedCount = 0;
103 int operationsCompleted = 0;
104 Set<String> exceptionsSwallowedClasses =
new HashSet<String>();
109 if(page == null || page.size() == 0){
113 for (T item : page) {
116 operationsCompleted++;
117 }
catch (Exception e){
119 exceptionsSwallowedCount++;
120 exceptionsSwallowedClasses.add(e.getClass().getName());
121 logger.debug(
"Swallowing exception " + e.getMessage(), e);
123 logger.debug(
"Rethrowing exception " + e.getMessage());
130 executionTime = System.currentTimeMillis() - startTime;
133 finalReport(operationsCompleted, exceptionsSwallowedCount, exceptionsSwallowedClasses);
abstract Collection< T > fetchPage()
long maxTime
Definition: AbstractPageOperationTemplate.java:50
boolean swallowExceptions
Definition: AbstractPageOperationTemplate.java:57
int maxPages
Definition: AbstractPageOperationTemplate.java:44
String getOperationName()
Definition: AbstractPageOperationTemplate.java:195
abstract void doOperation(T item)
void finalReport(int operationsCompleted, int exceptionsSwallowedCount, Set< String > exceptionsSwallowedClasses)
Definition: AbstractPageOperationTemplate.java:158
static final Logger logger
Definition: AbstractPageOperationTemplate.java:34