commit() public method

Commit this change and release the lock. If this method fails (returns false) the lock is still released.
/// the lock is not held. ///
public commit ( ) : bool
return bool
Example #1
0
 ///	<summary>
 /// Finish, write, commit this change, and release the index lock.
 /// <para />
 /// If this method fails (returns false) the lock is still released.
 /// <para />
 /// This is a utility method for applications as the finish-write-commit
 /// pattern is very common after using a builder to update entries.
 /// </summary>
 /// <returns>
 /// True if the commit was successful and the file contains the new
 /// data; false if the commit failed and the file remains with the
 /// old data.
 /// </returns>
 /// <exception cref="IOException">
 /// The output file could not be created. The caller no longer
 /// holds the lock.
 /// </exception>
 public virtual bool commit()
 {
     finish();
     _cache.write();
     return(_cache.commit());
 }