|
15 | 15 |
|
16 | 16 | @JCStressTest |
17 | 17 | @State |
18 | | -@Outcome(id = "2000, 2000", expect = ACCEPTABLE, desc = "No keys loaded twice") |
19 | | -@Outcome(id = "2.*, 2000", expect = ACCEPTABLE_INTERESTING, desc = "Some keys loaded twice") |
| 18 | +@Outcome(id = "1000, 1000", expect = ACCEPTABLE, desc = "No keys loaded twice") |
| 19 | +@Outcome(id = "1.*, 1000", expect = ACCEPTABLE_INTERESTING, desc = "Some keys loaded twice") |
20 | 20 | public class DataLoader_NoBatching_Caching_JCStress { |
21 | 21 |
|
22 | 22 |
|
23 | 23 | AtomicInteger batchLoaderCount = new AtomicInteger(); |
24 | | - volatile boolean finished1; |
25 | | - volatile boolean finished2; |
26 | | - |
27 | 24 |
|
28 | 25 | BatchLoader<String, String> batchLoader = keys -> { |
29 | 26 | batchLoaderCount.getAndAdd(keys.size()); |
30 | 27 | return CompletableFuture.completedFuture(keys); |
31 | 28 | }; |
32 | | - DataLoader<String, String> dataLoader = DataLoaderFactory.newDataLoader(batchLoader, DataLoaderOptions.newOptions().setBatchingEnabled(false).build()); |
33 | 29 |
|
34 | 30 |
|
| 31 | + DataLoader<String, String> dataLoader = DataLoaderFactory.newDataLoader(batchLoader, DataLoaderOptions.newOptions().setBatchingEnabled(false).build()); |
| 32 | + |
35 | 33 | @Actor |
36 | 34 | public void load1() { |
37 | 35 | for (int i = 0; i < 1000; i++) { |
38 | 36 | dataLoader.load("load-1-" + i); |
39 | 37 | } |
40 | | - // we load the same keys again |
41 | | - for (int i = 0; i < 1000; i++) { |
42 | | - dataLoader.load("load-1-" + i); |
43 | | - } |
44 | | - finished1 = true; |
45 | 38 | } |
46 | 39 |
|
47 | 40 | @Actor |
48 | 41 | public void load2() { |
49 | | - for (int i = 0; i < 1000; i++) { |
50 | | - dataLoader.load("load-2-" + i); |
51 | | - } |
52 | | - // we load the same keys again |
53 | 42 | for (int i = 0; i < 1000; i++) { |
54 | 43 | dataLoader.load("load-1-" + i); |
55 | 44 | } |
56 | | - finished2 = true; |
57 | 45 | } |
58 | 46 |
|
59 | 47 |
|
|
0 commit comments