private void tryCommitRecord(long currentRecordOffsetInFile,
                               int totalRecordLength) throws IOException {
    //FIXME: This method involves unnecessary contention -- in current implementation _each_ thread finalizing
    //       it's record also make an attempt to commit all records before the current one, and _all_ such
    //       threads compete on updating 'commited' cursor.
    //
    //       This contention could be removed entirely by stating that only the 'most lagging' thread -- i.e. the
    //       thread for which currentRecordOffsetInFile==firstUncommitedOffset() -- should update the 'commited'
    //       cursor. This is very natural way to do it, not only because of less contention, but also because in
    //       the most cases threads finalize their records in the same order they allocate them => each thread
    //       commits it's own record _only_. And in such case the whole update is simplified down to the single
    //       uncontended CAS, because everything needed for the update (=totalRecordLength) is already passed in
    //       as param -- i.e. we don't even need re-read record header => the most frequent case also becomes the
    //       fastest then.
    //
    //       Unfortunately, this logic currently breaks down because of end-of-page-padding record (see allocateSpaceForRecord):
    //       end-of-page-padding is inserted before 'current' record, so currentRecordOffset points to the actual
    //       record on the next page, while .nextRecordToBeCommitted keeps pointing to padding record, left on
    //       previous page. Thus currentRecordOffsetInFile!=firstUncommitedOffset() even though current thread
    //       _is_ the most lagging -- and after single such fault commited cursor is never updated anymore.
    ///
    //       This is not a fundamental flaw, just a feature of current implementation, it could be fixed. But
    //       right now I postpone the fix, and work it around by made _every_ thread responsible for committing
    //       finalized records.
    //       Review it later, find way to avoid spending CPU on useless contention

    tryCommitFinalizedRecords();
  }
private void tryCommitRecord(long currentRecordOffsetInFile,
                               int totalRecordLength)