Addressing comments and fixing the failing test.
This commit is contained in:
parent
48699f4812
commit
7d24bc54f8
2 changed files with 4 additions and 4 deletions
|
|
@ -137,7 +137,7 @@ public class PrefetchGetRecordsCache implements GetRecordsCache {
|
||||||
return result.getRecords().stream().mapToLong(record -> record.getData().array().length).sum();
|
return result.getRecords().stream().mapToLong(record -> record.getData().array().length).sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldGetNewRecords() {
|
public synchronized boolean shouldGetNewRecords() {
|
||||||
return size < maxRecordsCount && byteSize < maxByteSize;
|
return size < maxRecordsCount && byteSize < maxByteSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,11 +51,11 @@ public class BlockingGetRecordsCacheTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
when(getRecordsRetrievalStrategy.getRecords(eq(MAX_RECORDS_PER_COUNT))).thenReturn(getRecordsResult);
|
|
||||||
when(getRecordsResult.getRecords()).thenReturn(records);
|
|
||||||
|
|
||||||
records = new ArrayList<>();
|
records = new ArrayList<>();
|
||||||
blockingGetRecordsCache = new BlockingGetRecordsCache(MAX_RECORDS_PER_COUNT, getRecordsRetrievalStrategy);
|
blockingGetRecordsCache = new BlockingGetRecordsCache(MAX_RECORDS_PER_COUNT, getRecordsRetrievalStrategy);
|
||||||
|
|
||||||
|
when(getRecordsRetrievalStrategy.getRecords(eq(MAX_RECORDS_PER_COUNT))).thenReturn(getRecordsResult);
|
||||||
|
when(getRecordsResult.getRecords()).thenReturn(records);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue