mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
locks should throw InterruptedException or return when the current thread is interrupted
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
<dependency>
|
||||
<groupId>net.openhft</groupId>
|
||||
<artifactId>lang</artifactId>
|
||||
<version>6.4.22</version>
|
||||
<version>6.5.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -1469,6 +1469,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
final DirectBitSet positions = hashLookup.getPositions();
|
||||
class EntryChecker implements MultiMap.EntryConsumer {
|
||||
long size = 0;
|
||||
|
||||
@Override
|
||||
public void accept(long key, long value) {
|
||||
if (positions.isSet(value))
|
||||
@@ -1527,7 +1528,12 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
@Nullable SegmentState segmentState) {
|
||||
while (true) {
|
||||
// final boolean success = segmentHeader.tryRWReadLock(LOCK_OFFSET, lockTimeOutNS);
|
||||
final boolean success = segmentHeader.tryRWWriteLock(LOCK_OFFSET, lockTimeOutNS);
|
||||
final boolean success;
|
||||
try {
|
||||
success = segmentHeader.tryRWWriteLock(LOCK_OFFSET, lockTimeOutNS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
/*
|
||||
boolean success = false;
|
||||
try {
|
||||
@@ -1563,7 +1569,12 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
SegmentState segmentState, boolean nativeValueClass) {
|
||||
startWriteLock = System.nanoTime();
|
||||
while (true) {
|
||||
final boolean success = segmentHeader.tryRWWriteLock(LOCK_OFFSET, lockTimeOutNS);
|
||||
final boolean success;
|
||||
try {
|
||||
success = segmentHeader.tryRWWriteLock(LOCK_OFFSET, lockTimeOutNS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
/*
|
||||
boolean success = false;
|
||||
try {
|
||||
@@ -1970,7 +1981,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
final void freeExtraAllocatedChunks(long pos, int allocatedChunks, Bytes entry) {
|
||||
int actuallyUsedChunks;
|
||||
if (!constantlySizedEntry && couldNotDetermineAlignmentBeforeAllocation && // fast path
|
||||
(actuallyUsedChunks = inChunks(entry.position())) < allocatedChunks) {
|
||||
(actuallyUsedChunks = inChunks(entry.position())) < allocatedChunks) {
|
||||
free(pos + actuallyUsedChunks, allocatedChunks - actuallyUsedChunks);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user