public void updatePrepared(Update update) {
if (status != STARTED) {
log.info("not started: update prepare ignored.");
return;
}
Record record = (Record) update.getAttribute(ATTRIBUTE_RECORD);
if (record == null) {
String msg = "No record created.";
log.warn(msg);
return;
}
List<EventState> events = update.getEvents();
ChangeLog changes = update.getChanges();
boolean succeeded = false;
try {
ChangeLogRecord clr = new ChangeLogRecord(changes, events,
record, workspace, update.getTimestamp(),
update.getUserData());
clr.write();
succeeded = true;
} catch (JournalException e) {
String msg = "Unable to create log entry: " + e.getMessage();
log.error(msg);
} catch (Throwable e) {
String msg = "Unexpected error while preparing log entry.";
log.error(msg, e);
} finally {
if (!succeeded && record != null) {
record.cancelUpdate();
update.setAttribute(ATTRIBUTE_RECORD, null);
}
}
}