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;
}
EventStateCollection events = update.getEvents();
ChangeLog changes = update.getChanges();
boolean succeeded = false;
try {
record.writeString(workspace);
write(record, changes, events);
record.writeChar('\0');
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);
}
}
}