Search in sources :

Example 1 with PreCommitHook

use of org.sirix.api.PreCommitHook in project sirix by sirixdb.

the class XdmNodeWriterTrxImpl method commit.

@Override
public XdmNodeWriteTrx commit() {
    mNodeReader.assertNotClosed();
    // Execute pre-commit hooks.
    for (final PreCommitHook hook : mPreCommitHooks) {
        hook.preCommit(this);
    }
    // Reset modification counter.
    mModificationCount = 0L;
    // Optionally lock while commiting and assigning new instances.
    acquireLock();
    try {
        final UberPage uberPage = getPageTransaction().commit();
        // Remember succesfully committed uber page in resource manager.
        mNodeReader.mResourceManager.setLastCommittedUberPage(uberPage);
        // Reinstantiate everything.
        reInstantiate(getId(), getRevisionNumber());
    } finally {
        unLock();
    }
    // Execute post-commit hooks.
    for (final PostCommitHook hook : mPostCommitHooks) {
        hook.postCommit(this);
    }
    return this;
}
Also used : PostCommitHook(org.sirix.api.PostCommitHook) UberPage(org.sirix.page.UberPage) PreCommitHook(org.sirix.api.PreCommitHook)

Aggregations

PostCommitHook (org.sirix.api.PostCommitHook)1 PreCommitHook (org.sirix.api.PreCommitHook)1 UberPage (org.sirix.page.UberPage)1