ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/CyclicBarrierTest.java
(Generate patch)

Comparing jsr166/src/test/tck/CyclicBarrierTest.java (file contents):
Revision 1.9 by jsr166, Mon Nov 2 20:28:31 2009 UTC vs.
Revision 1.10 by jsr166, Mon Nov 16 04:57:10 2009 UTC

# Line 32 | Line 32 | public class CyclicBarrierTest extends J
32          try {
33              new CyclicBarrier(-1, (Runnable)null);
34              shouldThrow();
35 <        } catch(IllegalArgumentException e){}
35 >        } catch (IllegalArgumentException e){}
36      }
37  
38      /**
# Line 42 | Line 42 | public class CyclicBarrierTest extends J
42          try {
43              new CyclicBarrier(-1);
44              shouldThrow();
45 <        } catch(IllegalArgumentException e){}
45 >        } catch (IllegalArgumentException e){}
46      }
47  
48      /**
# Line 66 | Line 66 | public class CyclicBarrierTest extends J
66              b.await();
67              assertEquals(0, b.getNumberWaiting());
68          }
69 <        catch(Exception e) {
69 >        catch (Exception e) {
70              unexpectedException();
71          }
72      }
# Line 85 | Line 85 | public class CyclicBarrierTest extends J
85              assertEquals(0, b.getNumberWaiting());
86              assertEquals(countAction, 2);
87          }
88 <        catch(Exception e) {
88 >        catch (Exception e) {
89              unexpectedException();
90          }
91      }
# Line 102 | Line 102 | public class CyclicBarrierTest extends J
102                          b.await();
103                          b.await();
104                          b.await();
105 <                    } catch(Exception e){
105 >                    } catch (Exception e){
106                          threadUnexpectedException();
107                      }}});
108  
# Line 113 | Line 113 | public class CyclicBarrierTest extends J
113              b.await();
114              b.await();
115              t.join();
116 <        } catch(Exception e){
116 >        } catch (Exception e){
117              unexpectedException();
118          }
119      }
# Line 130 | Line 130 | public class CyclicBarrierTest extends J
130                      try {
131                          c.await();
132                          threadShouldThrow();
133 <                    } catch(InterruptedException success){}
134 <                    catch(Exception b){
133 >                    } catch (InterruptedException success){}
134 >                    catch (Exception b){
135                          threadUnexpectedException();
136                      }
137                  }
# Line 141 | Line 141 | public class CyclicBarrierTest extends J
141                      try {
142                          c.await();
143                          threadShouldThrow();
144 <                    } catch(BrokenBarrierException success){
145 <                    } catch(Exception i){
144 >                    } catch (BrokenBarrierException success){
145 >                    } catch (Exception i){
146                          threadUnexpectedException();
147                      }
148                  }
# Line 154 | Line 154 | public class CyclicBarrierTest extends J
154              t1.interrupt();
155              t1.join();
156              t2.join();
157 <        } catch(InterruptedException e){
157 >        } catch (InterruptedException e){
158              unexpectedException();
159          }
160      }
# Line 170 | Line 170 | public class CyclicBarrierTest extends J
170                      try {
171                          c.await(LONG_DELAY_MS, TimeUnit.MILLISECONDS);
172                          threadShouldThrow();
173 <                    } catch(InterruptedException success){
174 <                    } catch(Exception b){
173 >                    } catch (InterruptedException success){
174 >                    } catch (Exception b){
175                          threadUnexpectedException();
176                      }
177                  }
# Line 181 | Line 181 | public class CyclicBarrierTest extends J
181                      try {
182                          c.await(LONG_DELAY_MS, TimeUnit.MILLISECONDS);
183                          threadShouldThrow();
184 <                    } catch(BrokenBarrierException success){
185 <                    } catch(Exception i){
184 >                    } catch (BrokenBarrierException success){
185 >                    } catch (Exception i){
186                          threadUnexpectedException();
187                      }
188                  }
# Line 194 | Line 194 | public class CyclicBarrierTest extends J
194              t1.interrupt();
195              t1.join();
196              t2.join();
197 <        } catch(InterruptedException e){
197 >        } catch (InterruptedException e){
198              unexpectedException();
199          }
200      }
# Line 209 | Line 209 | public class CyclicBarrierTest extends J
209                      try {
210                          c.await(SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
211                          threadShouldThrow();
212 <                    } catch(TimeoutException success){
213 <                    } catch(Exception b){
212 >                    } catch (TimeoutException success){
213 >                    } catch (Exception b){
214                          threadUnexpectedException();
215  
216                      }
# Line 219 | Line 219 | public class CyclicBarrierTest extends J
219          try {
220              t.start();
221              t.join();
222 <        } catch(InterruptedException e){
222 >        } catch (InterruptedException e){
223              unexpectedException();
224          }
225      }
# Line 235 | Line 235 | public class CyclicBarrierTest extends J
235                      try {
236                          c.await(SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
237                          threadShouldThrow();
238 <                    } catch(TimeoutException success){
239 <                    } catch(Exception b){
238 >                    } catch (TimeoutException success){
239 >                    } catch (Exception b){
240                          threadUnexpectedException();
241                      }
242                  }
# Line 246 | Line 246 | public class CyclicBarrierTest extends J
246                      try {
247                          c.await(MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
248                          threadShouldThrow();
249 <                    } catch(BrokenBarrierException success){
250 <                    } catch(Exception i){
249 >                    } catch (BrokenBarrierException success){
250 >                    } catch (Exception i){
251                          threadUnexpectedException();
252                      }
253                  }
# Line 257 | Line 257 | public class CyclicBarrierTest extends J
257              t2.start();
258              t1.join();
259              t2.join();
260 <        } catch(InterruptedException e){
260 >        } catch (InterruptedException e){
261              unexpectedException();
262          }
263      }
# Line 273 | Line 273 | public class CyclicBarrierTest extends J
273                      try {
274                          c.await(SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
275                          threadShouldThrow();
276 <                    } catch(TimeoutException success){
277 <                    } catch(Exception b){
276 >                    } catch (TimeoutException success){
277 >                    } catch (Exception b){
278                          threadUnexpectedException();
279                      }
280                  }
# Line 284 | Line 284 | public class CyclicBarrierTest extends J
284                      try {
285                          c.await();
286                          threadShouldThrow();
287 <                    } catch(BrokenBarrierException success){
288 <                    } catch(Exception i){
287 >                    } catch (BrokenBarrierException success){
288 >                    } catch (Exception i){
289                          threadUnexpectedException();
290                      }
291                  }
# Line 295 | Line 295 | public class CyclicBarrierTest extends J
295              t2.start();
296              t1.join();
297              t2.join();
298 <        } catch(InterruptedException e){
298 >        } catch (InterruptedException e){
299              unexpectedException();
300          }
301      }
# Line 311 | Line 311 | public class CyclicBarrierTest extends J
311                      try {
312                          c.await();
313                          threadShouldThrow();
314 <                    } catch(BrokenBarrierException success){}
315 <                    catch(Exception b){
314 >                    } catch (BrokenBarrierException success){}
315 >                    catch (Exception b){
316                          threadUnexpectedException();
317                      }
318                  }
# Line 322 | Line 322 | public class CyclicBarrierTest extends J
322                      try {
323                          c.await();
324                          threadShouldThrow();
325 <                    } catch(BrokenBarrierException success){
326 <                    } catch(Exception i){
325 >                    } catch (BrokenBarrierException success){
326 >                    } catch (Exception i){
327                          threadUnexpectedException();
328                      }
329                  }
# Line 335 | Line 335 | public class CyclicBarrierTest extends J
335              c.reset();
336              t1.join();
337              t2.join();
338 <        } catch(InterruptedException e){
338 >        } catch (InterruptedException e){
339              unexpectedException();
340          }
341      }
# Line 350 | Line 350 | public class CyclicBarrierTest extends J
350                  public void run() {
351                      try {
352                          c.await();
353 <                    } catch(Exception b){
353 >                    } catch (Exception b){
354                          threadUnexpectedException();
355                      }
356                  }
# Line 359 | Line 359 | public class CyclicBarrierTest extends J
359                  public void run() {
360                      try {
361                          c.await();
362 <                    } catch(Exception i){
362 >                    } catch (Exception i){
363                          threadUnexpectedException();
364                      }
365                  }
# Line 371 | Line 371 | public class CyclicBarrierTest extends J
371              c.await();
372              t1.join();
373              t2.join();
374 <        } catch(Exception e){
374 >        } catch (Exception e){
375              unexpectedException();
376          }
377      }
# Line 402 | Line 402 | public class CyclicBarrierTest extends J
402                  };
403  
404              t.start();
405 <            for( int i = 0; i < 4; i++) {
405 >            for ( int i = 0; i < 4; i++) {
406                  Thread.sleep(SHORT_DELAY_MS);
407                  t.interrupt();
408              }
# Line 479 | Line 479 | public class CyclicBarrierTest extends J
479                                  threadFail("start barrier");
480                              }
481                              try { barrier.await(); }
482 <                            catch(InterruptedException ok) {}
482 >                            catch (InterruptedException ok) {}
483                              catch (Throwable thrown) {
484                                  unexpectedException();
485                              }}});
# Line 491 | Line 491 | public class CyclicBarrierTest extends J
491                                  threadFail("start barrier");
492                              }
493                              try { barrier.await(); }
494 <                            catch(BrokenBarrierException ok) {}
494 >                            catch (BrokenBarrierException ok) {}
495                              catch (Throwable thrown) {
496                                  unexpectedException();
497                              }}});
# Line 530 | Line 530 | public class CyclicBarrierTest extends J
530                                  threadFail("start barrier");
531                              }
532                              try { barrier.await(MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS); }
533 <                            catch(TimeoutException ok) {}
533 >                            catch (TimeoutException ok) {}
534                              catch (Throwable thrown) {
535                                  unexpectedException();
536                              }}});
# Line 542 | Line 542 | public class CyclicBarrierTest extends J
542                                  threadFail("start barrier");
543                              }
544                              try { barrier.await(); }
545 <                            catch(BrokenBarrierException ok) {}
545 >                            catch (BrokenBarrierException ok) {}
546                              catch (Throwable thrown) {
547                                  unexpectedException();
548                              }}});
# Line 584 | Line 584 | public class CyclicBarrierTest extends J
584                                  threadFail("start barrier");
585                              }
586                              try { barrier.await(); }
587 <                            catch(BrokenBarrierException ok) {}
587 >                            catch (BrokenBarrierException ok) {}
588                              catch (Throwable thrown) {
589                                  unexpectedException();
590                              }}});
# Line 596 | Line 596 | public class CyclicBarrierTest extends J
596                                  threadFail("start barrier");
597                              }
598                              try { barrier.await(); }
599 <                            catch(BrokenBarrierException ok) {}
599 >                            catch (BrokenBarrierException ok) {}
600                              catch (Throwable thrown) {
601                                  unexpectedException();
602                              }}});

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines