@@ -39,21 +39,18 @@ public void testAcquireAndRelease() throws Exception {
39
39
assertThat ("Cache file is not acquired: file does not exist" , Files .exists (file ), is (false ));
40
40
41
41
final TestEvictionListener listener = new TestEvictionListener ();
42
- boolean acquired = cacheFile .acquire (listener );
43
- assertThat ("Cache file has been acquired" , acquired , is (true ));
42
+ cacheFile .acquire (listener );
44
43
assertThat ("Cache file has been acquired: file should exists" , Files .exists (file ), is (true ));
45
44
assertThat ("Cache file has been acquired: channel should exists" , cacheFile .getChannel (), notNullValue ());
46
45
assertThat ("Cache file has been acquired: channel is open" , cacheFile .getChannel ().isOpen (), is (true ));
47
46
assertThat ("Cache file has been acquired: eviction listener is not executed" , listener .isCalled (), is (false ));
48
47
49
- boolean released = cacheFile .release (listener );
50
- assertThat ("Cache file has been released" , released , is (true ));
48
+ cacheFile .release (listener );
51
49
assertThat ("Cache file has been released: eviction listener is not executed" , listener .isCalled (), is (false ));
52
50
assertThat ("Cache file has been released: channel does not exist" , cacheFile .getChannel (), nullValue ());
53
51
assertThat ("Cache file is not evicted: file still exists after release" , Files .exists (file ), is (true ));
54
52
55
- acquired = cacheFile .acquire (listener );
56
- assertThat ("Cache file is acquired again" , acquired , is (true ));
53
+ cacheFile .acquire (listener );
57
54
58
55
FileChannel fileChannel = cacheFile .getChannel ();
59
56
assertThat ("Channel should exists" , fileChannel , notNullValue ());
@@ -68,8 +65,7 @@ public void testAcquireAndRelease() throws Exception {
68
65
assertThat ("Cache file is evicted but not fully released: channel is open" , cacheFile .getChannel ().isOpen (), is (true ));
69
66
assertThat ("Channel didn't change after eviction" , cacheFile .getChannel (), sameInstance (fileChannel ));
70
67
71
- released = cacheFile .release (listener );
72
- assertTrue ("Cache file is fully released" , released );
68
+ cacheFile .release (listener );
73
69
assertThat ("Cache file evicted and fully released: channel does not exist" , cacheFile .getChannel (), nullValue ());
74
70
assertThat ("Cache file has been deleted" , Files .exists (file ), is (false ));
75
71
}
@@ -83,14 +79,12 @@ public void testCacheFileNotAcquired() throws IOException {
83
79
84
80
if (randomBoolean ()) {
85
81
final TestEvictionListener listener = new TestEvictionListener ();
86
- boolean acquired = cacheFile .acquire (listener );
87
- assertTrue ("Cache file is acquired" , acquired );
82
+ cacheFile .acquire (listener );
88
83
89
84
assertThat (cacheFile .getChannel (), notNullValue ());
90
85
assertThat (Files .exists (file ), is (true ));
91
86
92
- boolean released = cacheFile .release (listener );
93
- assertTrue ("Cache file is released" , released );
87
+ cacheFile .release (listener );
94
88
}
95
89
96
90
cacheFile .startEviction ();
@@ -105,7 +99,7 @@ public void testDeleteOnCloseAfterLastRelease() throws Exception {
105
99
final List <TestEvictionListener > acquiredListeners = new ArrayList <>();
106
100
for (int i = 0 ; i < randomIntBetween (1 , 20 ); i ++) {
107
101
TestEvictionListener listener = new TestEvictionListener ();
108
- assertTrue ( cacheFile .acquire (listener ) );
102
+ cacheFile .acquire (listener );
109
103
assertThat (cacheFile .getChannel (), notNullValue ());
110
104
acquiredListeners .add (listener );
111
105
}
@@ -135,7 +129,7 @@ public void testConcurrentAccess() throws Exception {
135
129
final CacheFile cacheFile = new CacheFile ("test" , randomLongBetween (1 , 100 ), file );
136
130
137
131
final TestEvictionListener evictionListener = new TestEvictionListener ();
138
- assertTrue ( cacheFile .acquire (evictionListener ) );
132
+ cacheFile .acquire (evictionListener );
139
133
final long length = cacheFile .getLength ();
140
134
final DeterministicTaskQueue deterministicTaskQueue = new DeterministicTaskQueue (
141
135
builder ().put (NODE_NAME_SETTING .getKey (), getTestName ()).build (),
0 commit comments