Commit-Time Callbacks
Commit-time callbacks were introduced in db4o version 6.2.
Commit-time callbacks allow a user to add some specific
behavior just before and just after a transaction is committed.
Typical use-cases for commit-time callbacks:
- add constraint-violation checking before commit;
- check application-specific conditions before commit is done;
- start synchronization or backup after commit;
- notify other clients/applications about
successful/unsuccessful commit.
Commit-time callbacks can be triggered by the following 2 events:
- Committing: event
subscribers are notified before the container starts any meaningful commit
work and are allowed to cancel the entire operation by throwing an
exception; the ObjectContainer instance is completely blocked while
subscribers are being notified which is both a blessing because
subscribers can count on a stable and safe environment and a curse because
it prevents any parallelism with the container;
- Committed:
event subscribers are notified in a separate thread after the container has completely
finished the commit operation; exceptions if any will be ignored.