forked from Qortal/qortal
fileListCache is now an immutable Map, which is thread safe. Thanks to catbref for this idea.
This commit is contained in:
parent
b764172500
commit
6aad6a1618
@ -63,7 +63,7 @@ public class BlockArchiveReader {
|
||||
map.put(filename, new Triple(startHeight, endHeight, range));
|
||||
}
|
||||
}
|
||||
this.fileListCache = map;
|
||||
this.fileListCache = Map.copyOf(map);
|
||||
}
|
||||
|
||||
public Triple<BlockData, List<TransactionData>, List<ATStateData>> fetchBlockAtHeight(int height) {
|
||||
@ -145,7 +145,6 @@ public class BlockArchiveReader {
|
||||
}
|
||||
|
||||
private String getFilenameForHeight(int height) {
|
||||
synchronized (this.fileListCache) {
|
||||
Iterator it = this.fileListCache.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry) it.next();
|
||||
@ -162,7 +161,6 @@ public class BlockArchiveReader {
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user