mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -13,9 +13,9 @@ final class MappedFileSimpleStorage implements ISimpleStorage {
|
||||
storage = new ResizeableMappedFile(file, initialSize, PersistentEnumeratorBase.ourLock);
|
||||
}
|
||||
|
||||
public MappedFileSimpleStorage(File file, int initialSize, int pageSize, float growFactor, boolean zeroPagesWhenExpand) throws IOException {
|
||||
public MappedFileSimpleStorage(File file, int initialSize, int pageSize, boolean zeroPagesWhenExpand) throws IOException {
|
||||
FileUtil.createIfDoesntExist(file);
|
||||
storage = new ResizeableMappedFile(file, initialSize, PersistentEnumeratorBase.ourLock, pageSize, growFactor, zeroPagesWhenExpand);
|
||||
storage = new ResizeableMappedFile(file, initialSize, PersistentEnumeratorBase.ourLock, pageSize, zeroPagesWhenExpand);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,9 +29,8 @@ public class ResizeableMappedFile implements Forceable {
|
||||
|
||||
private long myLogicalSize;
|
||||
private final PagedFileStorage myStorage;
|
||||
private final float myGrowFactor;
|
||||
|
||||
public ResizeableMappedFile(final File file, int initialSize, PagedFileStorage.StorageLock lock, int pageSize, float growFactor, boolean zeroWhenExpand) throws IOException {
|
||||
public ResizeableMappedFile(final File file, int initialSize, PagedFileStorage.StorageLock lock, int pageSize, boolean zeroWhenExpand) throws IOException {
|
||||
myStorage = new PagedFileStorage(file, lock, pageSize, zeroWhenExpand);
|
||||
if (!file.exists() || file.length() == 0) {
|
||||
writeLength(0);
|
||||
@@ -43,13 +42,10 @@ public class ResizeableMappedFile implements Forceable {
|
||||
resize(initialSize);
|
||||
}
|
||||
}
|
||||
|
||||
assert growFactor > 8f:"growFactor / 8 should be > 1";
|
||||
myGrowFactor = growFactor;
|
||||
}
|
||||
|
||||
public ResizeableMappedFile(final File file, int initialSize, PagedFileStorage.StorageLock lock) throws IOException {
|
||||
this(file, initialSize, lock, PagedFileStorage.DEFAULT_BUFFER_SIZE, 13f, true);
|
||||
this(file, initialSize, lock, PagedFileStorage.DEFAULT_BUFFER_SIZE, true);
|
||||
}
|
||||
|
||||
public long length() {
|
||||
@@ -78,7 +74,7 @@ public class ResizeableMappedFile implements Forceable {
|
||||
}
|
||||
|
||||
private void expand() {
|
||||
final long newSize = Math.min(Integer.MAX_VALUE, ((long)((realSize() + 1) * myGrowFactor)) >> 3);
|
||||
final long newSize = Math.min(Integer.MAX_VALUE, ((realSize() + 1) * 13) >> 3);
|
||||
resize((int)newSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user