@Override public void execute(ILifecycleProgressMonitor monitor) throws SiteWhereException { monitor.pushContext(new LifecycleProgressContext(steps.size(), getName())); StringBuffer buffer = new StringBuffer(); buffer.append("About to process composite lifecycle with " + steps.size() + "steps:\n"); for (ILifecycleStep step : steps) { buffer.append(" " + step.getName() + "\n"); } LOGGER.debug(buffer.toString()); try { for (ILifecycleStep step : steps) { LOGGER.debug("Starting " + step.getName()); monitor.startProgress(step.getName()); step.execute(monitor); monitor.finishProgress(); } } finally { monitor.popContext(); } }
@Override public void execute(ILifecycleProgressMonitor monitor) throws SiteWhereException { monitor.pushContext(new LifecycleProgressContext(steps.size(), getName())); try { for (ILifecycleStep step : steps) { LOGGER.debug("Starting " + step.getName()); ActiveSpan span = monitor.getMicroservice().getTracer().activeSpan(); try { TracerUtils.logToSpan(span, "Starting step '" + step.getName() + "'."); monitor.startProgress(step.getName()); step.execute(monitor); monitor.finishProgress(); } catch (SiteWhereException e) { TracerUtils.handleErrorInTracerSpan(span, e); throw e; } catch (Throwable t) { SiteWhereException e = new SiteWhereException("Unhandled exception in composite lifecycle step.", t); TracerUtils.handleErrorInTracerSpan(span, e); throw e; } } } finally { monitor.popContext(); } }