Java 类com.intellij.util.io.PagePool 实例源码

项目:intellij-ce-playground    文件:DataTable.java   
public DataTable(final File filePath, final PagePool pool) throws IOException {
  myFile = new RandomAccessDataFile(filePath, pool);
  if (myFile.length() == 0) {
    markDirty();
  }
  else {
    readInHeader(filePath);
  }
}
项目:intellij-ce-playground    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath,
                          PagePool pool,
                          CapacityAllocationPolicy capacityAllocationPolicy) throws IOException {
  myCapacityAllocationPolicy = capacityAllocationPolicy != null ? capacityAllocationPolicy
                                                                : CapacityAllocationPolicy.DEFAULT;
  tryInit(storageFilePath, pool, 0);
}
项目:intellij-ce-playground    文件:AbstractRecordsTable.java   
public AbstractRecordsTable(final File storageFilePath, final PagePool pool) throws IOException {
  myStorage = new RandomAccessDataFile(storageFilePath, pool);
  if (myStorage.length() == 0) {
    myStorage.put(0, new byte[getHeaderSize()], 0, getHeaderSize());
    markDirty();
  }
  else {
    if (myStorage.getInt(HEADER_MAGIC_OFFSET) != getSafelyClosedMagic()) {
      myStorage.dispose();
      throw new IOException("Records table for '" + storageFilePath + "' haven't been closed correctly. Rebuild required.");
    }
  }
}
项目:tools-idea    文件:DataTable.java   
public DataTable(final File filePath, final PagePool pool) throws IOException {
  myFile = new RandomAccessDataFile(filePath, pool);
  if (myFile.length() == 0) {
    markDirty();
  }
  else {
    readInHeader(filePath);
  }
}
项目:tools-idea    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath,
                          PagePool pool,
                          CapacityAllocationPolicy capacityAllocationPolicy) throws IOException {
  myCapacityAllocationPolicy = capacityAllocationPolicy != null ? capacityAllocationPolicy
                                                                : CapacityAllocationPolicy.DEFAULT;
  tryInit(storageFilePath, pool, 0);
}
项目:tools-idea    文件:AbstractRecordsTable.java   
public AbstractRecordsTable(final File storageFilePath, final PagePool pool) throws IOException {
  myStorage = new RandomAccessDataFile(storageFilePath, pool);
  if (myStorage.length() == 0) {
    myStorage.put(0, new byte[getHeaderSize()], 0, getHeaderSize());
    markDirty();
  }
  else {
    if (myStorage.getInt(HEADER_MAGIC_OFFSET) != getSafelyClosedMagic()) {
      myStorage.dispose();
      throw new IOException("Records table for '" + storageFilePath + "' haven't been closed correctly. Rebuild required.");
    }
  }
}
项目:consulo    文件:DataTable.java   
public DataTable(final File filePath, final PagePool pool) throws IOException {
  myFile = new RandomAccessDataFile(filePath, pool);
  if (myFile.length() == 0) {
    markDirty();
  }
  else {
    readInHeader(filePath);
  }
}
项目:consulo    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath,
                          PagePool pool,
                          CapacityAllocationPolicy capacityAllocationPolicy) throws IOException {
  myCapacityAllocationPolicy = capacityAllocationPolicy != null ? capacityAllocationPolicy
                                                                : CapacityAllocationPolicy.DEFAULT;
  tryInit(storageFilePath, pool, 0);
}
项目:consulo    文件:AbstractRecordsTable.java   
public AbstractRecordsTable(final File storageFilePath, final PagePool pool) throws IOException {
  myStorage = new RandomAccessDataFile(storageFilePath, pool);
  if (myStorage.length() == 0) {
    myStorage.put(0, new byte[getHeaderSize()], 0, getHeaderSize());
    markDirty();
  }
  else {
    if (myStorage.getInt(HEADER_MAGIC_OFFSET) != getSafelyClosedMagic()) {
      myStorage.dispose();
      throw new IOException("Records table for '" + storageFilePath + "' haven't been closed correctly. Rebuild required.");
    }
  }
}
项目:intellij-ce-playground    文件:LocalHistoryRecordsTable.java   
public LocalHistoryRecordsTable(final File storageFilePath, final PagePool pool) throws IOException {
  super(storageFilePath, pool);
}
项目:intellij-ce-playground    文件:LocalHistoryStorage.java   
public LocalHistoryStorage(String storageFilePath, PagePool pool) throws IOException {
  super(storageFilePath, pool);
}
项目:intellij-ce-playground    文件:LocalHistoryStorage.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new LocalHistoryRecordsTable(recordsFile, pool);
}
项目:intellij-ce-playground    文件:CompactRecordsTable.java   
public CompactRecordsTable(File recordsFile, PagePool pool, boolean forceSplit) throws IOException {
  super(recordsFile, pool);
  zeroes = new byte[getRecordSize()];
  this.forceSplit = forceSplit;
}
项目:intellij-ce-playground    文件:CompactStorageTest.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new CompactRecordsTable(recordsFile, pool, false);
}
项目:intellij-ce-playground    文件:RefCountingStorage.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new RefCountingRecordsTable(recordsFile, pool);
}
项目:intellij-ce-playground    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath) throws IOException {
  this(storageFilePath, PagePool.SHARED);
}
项目:intellij-ce-playground    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath, PagePool pool) throws IOException {
  this(storageFilePath, pool, CapacityAllocationPolicy.DEFAULT);
}
项目:intellij-ce-playground    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath,
                          CapacityAllocationPolicy capacityAllocationPolicy) throws IOException {
  this(storageFilePath, PagePool.SHARED, capacityAllocationPolicy);
}
项目:intellij-ce-playground    文件:AbstractStorage.java   
private void tryInit(String storageFilePath, PagePool pool, int retryCount) throws IOException {
  convertFromOldExtensions(storageFilePath);

  final File recordsFile = new File(storageFilePath + INDEX_EXTENSION);
  final File dataFile = new File(storageFilePath + DATA_EXTENSION);

  if (recordsFile.exists() != dataFile.exists()) {
    deleteFiles(storageFilePath);
  }

  FileUtil.createIfDoesntExist(recordsFile);
  FileUtil.createIfDoesntExist(dataFile);

  AbstractRecordsTable recordsTable = null;
  DataTable dataTable;
  try {
    recordsTable = createRecordsTable(pool, recordsFile);
    dataTable = new DataTable(dataFile, pool);
  }
  catch (IOException e) {
    LOG.info(e.getMessage());
    if (recordsTable != null) {
      recordsTable.dispose();
    }

    boolean deleted = deleteFiles(storageFilePath);
    if (!deleted) {
      throw new IOException("Can't delete caches at: " + storageFilePath);
    }
    if (retryCount >= 5) {
      throw new IOException("Can't create storage at: " + storageFilePath);
    }

    tryInit(storageFilePath, pool, retryCount+1);
    return;
  }

  myRecordsTable = recordsTable;
  myDataTable = dataTable;
  myPool = pool;

  if (myDataTable.isCompactNecessary()) {
    compact(storageFilePath);
  }
}
项目:intellij-ce-playground    文件:RefCountingRecordsTable.java   
public RefCountingRecordsTable(File recordsFile, PagePool pool) throws IOException {
  super(recordsFile, pool);
}
项目:intellij-ce-playground    文件:RecordsTable.java   
RecordsTable(File storageFilePath, PagePool pool) throws IOException {
  super(storageFilePath, pool);
}
项目:intellij-ce-playground    文件:Storage.java   
public Storage(String path, PagePool pool) throws IOException {
  super(path, pool);
}
项目:intellij-ce-playground    文件:Storage.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new RecordsTable(recordsFile, pool);
}
项目:tools-idea    文件:LocalHistoryRecordsTable.java   
public LocalHistoryRecordsTable(final File storageFilePath, final PagePool pool) throws IOException {
  super(storageFilePath, pool);
}
项目:tools-idea    文件:LocalHistoryStorage.java   
public LocalHistoryStorage(String storageFilePath, PagePool pool) throws IOException {
  super(storageFilePath, pool);
}
项目:tools-idea    文件:LocalHistoryStorage.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new LocalHistoryRecordsTable(recordsFile, pool);
}
项目:tools-idea    文件:RefCountingStorage.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new RefCountingRecordsTable(recordsFile, pool);
}
项目:tools-idea    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath) throws IOException {
  this(storageFilePath, PagePool.SHARED);
}
项目:tools-idea    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath, PagePool pool) throws IOException {
  this(storageFilePath, pool, CapacityAllocationPolicy.DEFAULT);
}
项目:tools-idea    文件:AbstractStorage.java   
protected AbstractStorage(String storageFilePath,
                          CapacityAllocationPolicy capacityAllocationPolicy) throws IOException {
  this(storageFilePath, PagePool.SHARED, capacityAllocationPolicy);
}
项目:tools-idea    文件:AbstractStorage.java   
private void tryInit(String storageFilePath, PagePool pool, int retryCount) throws IOException {
  convertFromOldExtensions(storageFilePath);

  final File recordsFile = new File(storageFilePath + INDEX_EXTENSION);
  final File dataFile = new File(storageFilePath + DATA_EXTENSION);

  if (recordsFile.exists() != dataFile.exists()) {
    deleteFiles(storageFilePath);
  }

  FileUtil.createIfDoesntExist(recordsFile);
  FileUtil.createIfDoesntExist(dataFile);

  AbstractRecordsTable recordsTable = null;
  DataTable dataTable;
  try {
    recordsTable = createRecordsTable(pool, recordsFile);
    dataTable = new DataTable(dataFile, pool);
  }
  catch (IOException e) {
    LOG.info(e.getMessage());
    if (recordsTable != null) {
      recordsTable.dispose();
    }

    boolean deleted = deleteFiles(storageFilePath);
    if (!deleted) {
      throw new IOException("Can't delete caches at: " + storageFilePath);
    }
    if (retryCount >= 5) {
      throw new IOException("Can't create storage at: " + storageFilePath);
    }

    tryInit(storageFilePath, pool, retryCount+1);
    return;
  }

  myRecordsTable = recordsTable;
  myDataTable = dataTable;
  myPool = pool;

  if (myDataTable.isCompactNecessary()) {
    compact(storageFilePath);
  }
}
项目:tools-idea    文件:RefCountingRecordsTable.java   
public RefCountingRecordsTable(File recordsFile, PagePool pool) throws IOException {
  super(recordsFile, pool);
}
项目:tools-idea    文件:RecordsTable.java   
RecordsTable(File storageFilePath, PagePool pool) throws IOException {
  super(storageFilePath, pool);
}
项目:tools-idea    文件:Storage.java   
public Storage(String path, PagePool pool) throws IOException {
  super(path, pool);
}
项目:tools-idea    文件:Storage.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new RecordsTable(recordsFile, pool);
}
项目:consulo    文件:LocalHistoryRecordsTable.java   
public LocalHistoryRecordsTable(final File storageFilePath, final PagePool pool) throws IOException {
  super(storageFilePath, pool);
}
项目:consulo    文件:LocalHistoryStorage.java   
public LocalHistoryStorage(String storageFilePath, PagePool pool) throws IOException {
  super(storageFilePath, pool);
}
项目:consulo    文件:LocalHistoryStorage.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new LocalHistoryRecordsTable(recordsFile, pool);
}
项目:consulo    文件:CompactRecordsTable.java   
public CompactRecordsTable(File recordsFile, PagePool pool, boolean forceSplit) throws IOException {
  super(recordsFile, pool);
  zeroes = new byte[getRecordSize()];
  this.forceSplit = forceSplit;
}
项目:consulo    文件:RefCountingStorage.java   
@Override
protected AbstractRecordsTable createRecordsTable(PagePool pool, File recordsFile) throws IOException {
  return new RefCountingRecordsTable(recordsFile, pool);
}