replace usages of SequenceLock with ReentrantLock

This commit is contained in:
Maxim.Mossienko
2016-03-03 17:07:24 +01:00
parent 06ddccb92a
commit e7dc1ded32
5 changed files with 11 additions and 13 deletions
@@ -26,7 +26,6 @@ import com.intellij.util.SystemProperties;
import com.intellij.util.containers.ContainerUtil;
import com.jgoodies.forms.layout.CellConstraints;
import io.netty.util.NetUtil;
import jsr166e.extra.SequenceLock;
import net.n3.nanoxml.IXMLBuilder;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.builders.impl.java.EclipseCompilerTool;
@@ -144,7 +143,6 @@ public class ClasspathBootstrap {
cp.add(getResourcePath(CellConstraints.class)); // jGoodies-forms
cp.add(getResourcePath(NotNullVerifyingInstrumenter.class)); // not-null
cp.add(getResourcePath(IXMLBuilder.class)); // nano-xml
cp.add(getResourcePath(SequenceLock.class)); // jsr166
cp.add(getJpsPluginSystemClassesPath().getAbsolutePath().replace('\\', '/'));
//don't forget to update layoutCommunityJps() in layouts.gant accordingly
@@ -79,7 +79,6 @@ import com.intellij.util.io.storage.HeavyProcessLatch;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.messages.MessageBusConnection;
import gnu.trove.*;
import jsr166e.extra.SequenceLock;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -92,6 +91,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author Eugene Zhuravlev
@@ -1163,7 +1163,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
++myFilesModCount;
}
private final Lock myCalcIndexableFilesLock = new SequenceLock();
private final Lock myCalcIndexableFilesLock = new ReentrantLock();
@Nullable
public ProjectIndexableFilesFilter projectIndexableFiles(@Nullable Project project) {
@@ -16,10 +16,10 @@
package com.intellij.util.containers;
import com.intellij.openapi.util.LowMemoryWatcher;
import jsr166e.extra.SequenceLock;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* User: Maxim.Mossienko
@@ -56,7 +56,7 @@ public class RecentStringInterner {
super.putToProtectedQueue(value, value);
}
};
myStripeLocks[i] = new SequenceLock();
myStripeLocks[i] = new ReentrantLock();
}
assert Integer.highestOneBit(stripes) == stripes;
@@ -16,11 +16,11 @@
package com.intellij.util.io;
import com.intellij.util.containers.SLRUMap;
import jsr166e.extra.SequenceLock;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author peter
@@ -44,7 +44,7 @@ public class CachingEnumerator<Data> implements DataEnumerator<Data> {
for(int i = 0; i < STRIPE_COUNT; ++i) {
myHashcodeToIdCache[i] = new SLRUMap<Integer, Integer>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT);
myIdToStringCache[i] = new SLRUMap<Integer, Data>(protectedSize / STRIPE_COUNT, probationalSize / STRIPE_COUNT);
myStripeLocks[i] = new SequenceLock();
myStripeLocks[i] = new ReentrantLock();
}
}
@@ -22,7 +22,6 @@ import com.intellij.util.SystemProperties;
import com.intellij.util.containers.ConcurrentIntObjectMap;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.hash.LinkedHashMap;
import jsr166e.extra.SequenceLock;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,6 +34,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author max
@@ -486,10 +486,10 @@ public class PagedFileStorage implements Forceable {
private final ConcurrentIntObjectMap<PagedFileStorage> myIndex2Storage = ContainerUtil.createConcurrentIntObjectMap();
private final LinkedHashMap<Integer, ByteBufferWrapper> mySegments;
private final SequenceLock mySegmentsAccessLock = new SequenceLock(); // protects map operations of mySegments, needed for LRU order, mySize and myMappingChangeCount
private final ReentrantLock mySegmentsAccessLock = new ReentrantLock(); // protects map operations of mySegments, needed for LRU order, mySize and myMappingChangeCount
// todo avoid locking for access
private final SequenceLock mySegmentsAllocationLock = new SequenceLock();
private final ReentrantLock mySegmentsAllocationLock = new ReentrantLock();
private final ConcurrentLinkedQueue<ByteBufferWrapper> mySegmentsToRemove = new ConcurrentLinkedQueue<ByteBufferWrapper>();
private volatile long mySize;
private volatile long mySizeLimit;
@@ -780,7 +780,7 @@ public class PagedFileStorage implements Forceable {
public static class StorageLockContext {
private final boolean myCheckThreadAccess;
private final SequenceLock myLock;
private final ReentrantLock myLock;
private final StorageLock myStorageLock;
@Deprecated
@@ -789,7 +789,7 @@ public class PagedFileStorage implements Forceable {
}
private StorageLockContext(StorageLock lock, boolean checkAccess) {
myLock = new SequenceLock();
myLock = new ReentrantLock();
myStorageLock = lock;
myCheckThreadAccess = checkAccess;
}