165 |
|
} |
166 |
|
|
167 |
|
/** |
168 |
< |
* register() correctly returns the current barrier phase number when |
169 |
< |
* invoked |
168 |
> |
* register() correctly returns the current barrier phase number |
169 |
> |
* when invoked |
170 |
|
*/ |
171 |
|
public void testRegister3() { |
172 |
|
Phaser phaser = new Phaser(); |
177 |
|
} |
178 |
|
|
179 |
|
/** |
180 |
< |
* register causes the next arrive to not increment the phase rather retain |
181 |
< |
* the phase number |
180 |
> |
* register causes the next arrive to not increment the phase |
181 |
> |
* rather retain the phase number |
182 |
|
*/ |
183 |
|
public void testRegister4() { |
184 |
|
Phaser phaser = new Phaser(1); |
189 |
|
} |
190 |
|
|
191 |
|
/** |
192 |
+ |
* register on a subphaser that is currently empty succeeds, even |
193 |
+ |
* in the presence of another non-empty subphaser |
194 |
+ |
*/ |
195 |
+ |
public void testRegisterEmptySubPhaser() { |
196 |
+ |
Phaser root = new Phaser(); |
197 |
+ |
Phaser child1 = new Phaser(root, 1); |
198 |
+ |
Phaser child2 = new Phaser(root, 0); |
199 |
+ |
assertEquals(0, child2.register()); |
200 |
+ |
assertState(root, 0, 2, 2); |
201 |
+ |
assertState(child1, 0, 1, 1); |
202 |
+ |
assertState(child2, 0, 1, 1); |
203 |
+ |
assertEquals(0, child2.arriveAndDeregister()); |
204 |
+ |
assertState(root, 0, 1, 1); |
205 |
+ |
assertState(child1, 0, 1, 1); |
206 |
+ |
assertState(child2, 0, 0, 0); |
207 |
+ |
assertEquals(0, child2.register()); |
208 |
+ |
assertEquals(0, child2.arriveAndDeregister()); |
209 |
+ |
assertState(root, 0, 1, 1); |
210 |
+ |
assertState(child1, 0, 1, 1); |
211 |
+ |
assertState(child2, 0, 0, 0); |
212 |
+ |
assertEquals(0, child1.arriveAndDeregister()); |
213 |
+ |
assertTerminated(root, 1); |
214 |
+ |
assertTerminated(child1, 1); |
215 |
+ |
assertTerminated(child2, 1); |
216 |
+ |
} |
217 |
+ |
|
218 |
+ |
/** |
219 |
|
* Invoking bulkRegister with a negative parameter throws an |
220 |
|
* IllegalArgumentException |
221 |
|
*/ |
227 |
|
} |
228 |
|
|
229 |
|
/** |
230 |
< |
* bulkRegister should correctly record the number of unarrived parties with |
231 |
< |
* the number of parties being registered |
230 |
> |
* bulkRegister should correctly record the number of unarrived |
231 |
> |
* parties with the number of parties being registered |
232 |
|
*/ |
233 |
|
public void testBulkRegister2() { |
234 |
|
Phaser phaser = new Phaser(); |