use of org.structr.bolt.wrapper.EntityWrapper in project structr by structr.
the class SessionTransaction method close.
@Override
public void close() {
if (!success) {
// be sure that they contain the correct values after a rollback.
for (final EntityWrapper entity : modifiedEntities) {
entity.stale();
}
} else {
// so that the relationship caches are rebuilt.
for (final EntityWrapper entity : modifiedEntities) {
entity.clearCaches();
}
}
// mark this transaction as closed BEFORE trying to actually close it
// so that it is closed in case of a failure
closed = true;
try {
tx.close();
session.close();
} catch (TransientException tex) {
// transient exceptions can be retried
throw new RetryException(tex);
} finally {
// so that the relationship caches are rebuilt.
for (final EntityWrapper entity : modifiedEntities) {
entity.onClose();
}
// make sure that the resources are freed
if (session.isOpen()) {
session.close();
}
}
}
Aggregations