mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use path hashing strategy
This commit is contained in:
@@ -66,7 +66,6 @@ import com.intellij.util.concurrency.SequentialTaskExecutor;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.net.NetUtils;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jboss.netty.bootstrap.ServerBootstrap;
|
||||
import org.jboss.netty.channel.*;
|
||||
import org.jboss.netty.channel.group.ChannelGroup;
|
||||
@@ -963,8 +962,8 @@ public class BuildManager implements ApplicationComponent{
|
||||
|
||||
private static class ProjectData {
|
||||
final SequentialTaskExecutor taskQueue;
|
||||
private final Set<String> myChanged = new THashSet<String>(PathHashingStrategy.INSTANCE);
|
||||
private final Set<String> myDeleted = new THashSet<String>(PathHashingStrategy.INSTANCE);
|
||||
private final Set<String> myChanged = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
|
||||
private final Set<String> myDeleted = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
|
||||
private long myNextEventOrdinal = 0L;
|
||||
private boolean myNeedRescan = true;
|
||||
|
||||
@@ -1009,20 +1008,6 @@ public class BuildManager implements ApplicationComponent{
|
||||
myChanged.clear();
|
||||
myDeleted.clear();
|
||||
}
|
||||
|
||||
static class PathHashingStrategy implements TObjectHashingStrategy<String> {
|
||||
static final PathHashingStrategy INSTANCE = new PathHashingStrategy();
|
||||
|
||||
@Override
|
||||
public int computeHashCode(String path) {
|
||||
return FileUtil.pathHashCode(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(String path1, String path2) {
|
||||
return FileUtil.pathsEqual(path1, path2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,13 +16,16 @@ import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/** @noinspection SynchronizationOnLocalVariableOrMethodParameter*/
|
||||
final class FilesDelta {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.fs.FilesDelta");
|
||||
|
||||
private final Set<String> myDeletedPaths = Collections.synchronizedSet(new HashSet<String>());
|
||||
private final Set<String> myDeletedPaths = Collections.synchronizedSet(new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY));
|
||||
private final Map<BuildRootDescriptor, Set<File>> myFilesToRecompile = Collections.synchronizedMap(new HashMap<BuildRootDescriptor, Set<File>>());
|
||||
|
||||
public void save(DataOutput out) throws IOException {
|
||||
@@ -155,7 +158,9 @@ final class FilesDelta {
|
||||
public Set<String> getAndClearDeletedPaths() {
|
||||
synchronized (myDeletedPaths) {
|
||||
try {
|
||||
return new HashSet<String>(myDeletedPaths);
|
||||
final THashSet<String> _paths = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
|
||||
_paths.addAll(myDeletedPaths);
|
||||
return _paths;
|
||||
}
|
||||
finally {
|
||||
myDeletedPaths.clear();
|
||||
|
||||
Reference in New Issue
Block a user