Addressing comments and fixing the failing test.

This commit is contained in:
Sahil Palvia 2017-09-21 13:23:22 -07:00
parent 48699f4812
commit 7d24bc54f8
2 changed files with 4 additions and 4 deletions

View file

@ -137,7 +137,7 @@ public class PrefetchGetRecordsCache implements GetRecordsCache {
return result.getRecords().stream().mapToLong(record -> record.getData().array().length).sum();
}
public boolean shouldGetNewRecords() {
public synchronized boolean shouldGetNewRecords() {
return size < maxRecordsCount && byteSize < maxByteSize;
}
}

View file

@ -51,11 +51,11 @@ public class BlockingGetRecordsCacheTest {
@Before
public void setup() {
when(getRecordsRetrievalStrategy.getRecords(eq(MAX_RECORDS_PER_COUNT))).thenReturn(getRecordsResult);
when(getRecordsResult.getRecords()).thenReturn(records);
records = new ArrayList<>();
blockingGetRecordsCache = new BlockingGetRecordsCache(MAX_RECORDS_PER_COUNT, getRecordsRetrievalStrategy);
when(getRecordsRetrievalStrategy.getRecords(eq(MAX_RECORDS_PER_COUNT))).thenReturn(getRecordsResult);
when(getRecordsResult.getRecords()).thenReturn(records);
}
@Test