cache: allow concurrent disk storage reads

This commit is contained in:
Max Weber
2020-12-01 14:41:46 -07:00
committed by Adam
parent a4daa407a1
commit 059edd77ca

View File

@@ -66,7 +66,7 @@ public class DataFile implements Closeable
* @return * @return
* @throws IOException * @throws IOException
*/ */
public byte[] read(int indexId, int archiveId, int sector, int size) throws IOException public synchronized byte[] read(int indexId, int archiveId, int sector, int size) throws IOException
{ {
if (sector <= 0L || dat.length() / SECTOR_SIZE < (long) sector) if (sector <= 0L || dat.length() / SECTOR_SIZE < (long) sector)
{ {
@@ -169,7 +169,7 @@ public class DataFile implements Closeable
return buffer.array(); return buffer.array();
} }
public DataFileWriteResult write(int indexId, int archiveId, byte[] compressedData) throws IOException public synchronized DataFileWriteResult write(int indexId, int archiveId, byte[] compressedData) throws IOException
{ {
int sector; int sector;
int startSector; int startSector;