posted 14 years ago
prepareCommit lets you do a 2-phased commit with Lucene and some other transactional resource(s).
Ie, you first call .prepareCommit in Lucene (and similarly in your other resources), which does nearly all the work required for a commit but does not in fact make the changes visible in the index.
If any resources hit an error during this phase, you can then call .rollback to remove all the changes.
Else, you then call .commit to make the change visible.
If you don't call .prepareCommit yourself externally, ie just call .commit, then internally Lucene will call .prepareCommit and then commit.