mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
review followup (IDEA-CR-23847)
This commit is contained in:
@@ -35,7 +35,7 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class CompressedAppendableFile {
|
||||
private final File myBaseFile;
|
||||
@SuppressWarnings({"FieldCanBeLocal", "unused"}) private final LowMemoryWatcher myLowMemoryWatcher;
|
||||
private final LowMemoryWatcher myLowMemoryWatcher;
|
||||
|
||||
// force will clear the buffer and reset the position
|
||||
private byte[] myNextChunkBuffer;
|
||||
@@ -74,6 +74,10 @@ public class CompressedAppendableFile {
|
||||
@Override
|
||||
public void run() {
|
||||
dropCaches();
|
||||
|
||||
synchronized (ourDecompressedCache) {
|
||||
ourDecompressedCache.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -460,6 +464,7 @@ public class CompressedAppendableFile {
|
||||
|
||||
public synchronized void dispose() {
|
||||
force();
|
||||
myLowMemoryWatcher.stop();
|
||||
}
|
||||
|
||||
public synchronized long length() {
|
||||
@@ -482,19 +487,9 @@ public class CompressedAppendableFile {
|
||||
|
||||
private static class FileChunkReadCache extends SLRUMap<FileChunkKey<CompressedAppendableFile>, byte[]> {
|
||||
private final FileChunkKey<CompressedAppendableFile> myKey = new FileChunkKey<CompressedAppendableFile>(null, 0);
|
||||
@SuppressWarnings({"FieldCanBeLocal", "unused"}) private final LowMemoryWatcher myLowMemoryWatcher;
|
||||
|
||||
FileChunkReadCache() {
|
||||
super(64, 64);
|
||||
|
||||
myLowMemoryWatcher = LowMemoryWatcher.register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (ourDecompressedCache) {
|
||||
ourDecompressedCache.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user