mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
move memWatcher back
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import com.intellij.openapi.Forceable;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.LowMemoryWatcher;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.io.MappingFailedException;
|
||||
@@ -81,6 +83,18 @@ public class IncProjectBuilder {
|
||||
}
|
||||
|
||||
public void build(CompileScope scope, final boolean isMake, final boolean isProjectRebuild, boolean forceCleanCaches) throws RebuildRequestedException{
|
||||
final LowMemoryWatcher memWatcher = LowMemoryWatcher.register(new Forceable() {
|
||||
@Override
|
||||
public boolean isDirty() {
|
||||
return true; // always perform flush when not enough memory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void force() {
|
||||
myProjectDescriptor.dataManager.flush(false);
|
||||
myTimestamps.force();
|
||||
}
|
||||
});
|
||||
CompileContext context = null;
|
||||
try {
|
||||
context = createContext(scope, isMake, isProjectRebuild);
|
||||
@@ -110,6 +124,7 @@ public class IncProjectBuilder {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
memWatcher.stop();
|
||||
flushContext(context);
|
||||
// wait for the async tasks
|
||||
for (Future task : myAsyncTasks) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.jetbrains.jps.server;
|
||||
|
||||
import com.intellij.openapi.Forceable;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.LowMemoryWatcher;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import groovy.util.Node;
|
||||
@@ -175,19 +173,6 @@ class ServerState {
|
||||
}
|
||||
|
||||
final ProjectDescriptor finalPd = pd;
|
||||
final LowMemoryWatcher memWatcher = LowMemoryWatcher.register(new Forceable() {
|
||||
@Override
|
||||
public boolean isDirty() {
|
||||
return true; // always perform flush when not enough memory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void force() {
|
||||
finalPd.dataManager.flush(false);
|
||||
finalPd.timestamps.getStorage().force();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
for (int attempt = 0; attempt < 2; attempt++) {
|
||||
if (forceCleanCaches && modules.isEmpty() && paths.isEmpty()) {
|
||||
@@ -241,7 +226,6 @@ class ServerState {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
memWatcher.stop();
|
||||
pd.release();
|
||||
clearZipIndexCache();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user