use of io.automatiko.engine.api.uow.WorkUnit in project automatiko-engine by automatiko-io.
the class CollectingUnitOfWork method end.
@Override
public void end() {
checkStarted();
Collection<WorkUnit<?>> units = sorted();
EventBatch batch = eventManager.newBatch();
batch.append(units);
for (WorkUnit<?> work : units) {
LOGGER.debug("Performing work unit {}", work);
try {
work.perform();
} catch (ConflictingVersionException e) {
throw e;
} catch (Exception e) {
LOGGER.error("Error during performing work unit {} error message {}", work, e.getMessage(), e);
}
}
eventManager.publish(batch);
done();
}
Aggregations