private final DetachedContextImpl detachedContext;
private final List sessions;
- private int skipCount = 0;
+ private int skipCount = 1;// start skipCount at 1 since the first step is
+ // always an open session
private BundleContext bundleContext;
public synchronized DetachedAnswer executeRequest(DetachedRequest request) {
DetachedAnswer answer = null;
try {
- // DetachedStep step = null;
-
// Find action
ServiceReference[] refs = bundleContext.getAllServiceReferences(
StaticRefProvider.class.getName(), null);
throw new DetachedException("Unknown action type "
+ obj.getClass() + " for action with ref "
+ request.getRef());
- } else {
- log.info("Processed '" + request.getRef() + "' (path="
- + request.getPath() + ")");
}
-
- } catch (DetachedException e) {
+ } catch (Exception e) {
answer = new DetachedAnswer(request);
answer.setStatus(DetachedAnswer.ERROR);
answer.setLog(e.getMessage());
- } catch (Exception e) {
- e.printStackTrace();
- throw new DetachedException(
- "Unexpected exception while executing request " + request,
- e);
}
getCurrentSession().getRequests().add(request);
getCurrentSession().getAnswers().add(answer);
+ if (log.isDebugEnabled())
+ log.debug("Processed '" + request.getRef() + "' (status="
+ + answer.getStatusAsString() + ", path="
+ + request.getPath() + ")");
return answer;
}
if (previousAnswer.getStatus() != DetachedAnswer.ERROR) {
execute = false;
+ String msg = "Skipped path " + request.getPath()
+ + " (skipCount=" + skipCount + ")";
+ skippedLog.append(msg);
+ log.info(msg);
+ skipCount++;
+ } else {
+ log
+ .info("Path "
+ + request.getPath()
+ + " was previously in error, executing it again."
+ + " (skipCount=" + skipCount + "). Reset skip count to 1");
+ skipCount = 1;
}
} else {
// went further as skip count, doing nothing.
DetachedStep step = (DetachedStep) obj;
answer = step.execute(detachedContext, request);
} else {
- skippedLog.append("Skipped path " + request.getPath()
- + " (skipCount=" + skipCount + ")");
answer = new DetachedAnswer(request);
answer.setStatus(DetachedAnswer.SKIPPED);
answer.setLog(skippedLog.toString());