private int reserveFreeRecord() throws IOException {
    ensureFreeRecordsScanned();
    synchronized (freeRecordsList) {
      return freeRecordsList.isEmpty() ? -1 : freeRecordsList.removeInt(freeRecordsList.size() - 1);
    }
  }
private int reserveFreeRecord()