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

Comparing jsr166/src/test/tck/ExchangerTest.java (file contents):
Revision 1.26 by dl, Tue Jan 26 13:33:06 2021 UTC vs.
Revision 1.27 by jsr166, Wed Jan 27 01:57:24 2021 UTC

# Line 28 | Line 28 | public class ExchangerTest extends JSR16
28       * exchange exchanges objects across two threads
29       */
30      public void testExchange() {
31 <        final Exchanger<Item> e = new Exchanger<Item>();
31 >        final Exchanger<Item> e = new Exchanger<>();
32          Thread t1 = newStartedThread(new CheckedRunnable() {
33              public void realRun() throws InterruptedException {
34                  assertSame(one, e.exchange(two));
# Line 48 | Line 48 | public class ExchangerTest extends JSR16
48       * timed exchange exchanges objects across two threads
49       */
50      public void testTimedExchange() {
51 <        final Exchanger<Item> e = new Exchanger<Item>();
51 >        final Exchanger<Item> e = new Exchanger<>();
52          Thread t1 = newStartedThread(new CheckedRunnable() {
53              public void realRun() throws Exception {
54                  assertSame(one, e.exchange(two, LONG_DELAY_MS, MILLISECONDS));
# Line 68 | Line 68 | public class ExchangerTest extends JSR16
68       * interrupt during wait for exchange throws InterruptedException
69       */
70      public void testExchange_InterruptedException() {
71 <        final Exchanger<Item> e = new Exchanger<Item>();
71 >        final Exchanger<Item> e = new Exchanger<>();
72          final CountDownLatch threadStarted = new CountDownLatch(1);
73          Thread t = newStartedThread(new CheckedInterruptedRunnable() {
74              public void realRun() throws InterruptedException {
# Line 85 | Line 85 | public class ExchangerTest extends JSR16
85       * interrupt during wait for timed exchange throws InterruptedException
86       */
87      public void testTimedExchange_InterruptedException() {
88 <        final Exchanger<Item> e = new Exchanger<Item>();
88 >        final Exchanger<Item> e = new Exchanger<>();
89          final CountDownLatch threadStarted = new CountDownLatch(1);
90          Thread t = newStartedThread(new CheckedInterruptedRunnable() {
91              public void realRun() throws Exception {
# Line 102 | Line 102 | public class ExchangerTest extends JSR16
102       * timeout during wait for timed exchange throws TimeoutException
103       */
104      public void testExchange_TimeoutException() {
105 <        final Exchanger<Item> e = new Exchanger<Item>();
105 >        final Exchanger<Item> e = new Exchanger<>();
106          Thread t = newStartedThread(new CheckedRunnable() {
107              public void realRun() throws Exception {
108                  long startTime = System.nanoTime();
# Line 120 | Line 120 | public class ExchangerTest extends JSR16
120       * If one exchanging thread is interrupted, another succeeds.
121       */
122      public void testReplacementAfterExchange() {
123 <        final Exchanger<Item> e = new Exchanger<Item>();
123 >        final Exchanger<Item> e = new Exchanger<>();
124          final CountDownLatch exchanged = new CountDownLatch(2);
125          final CountDownLatch interrupted = new CountDownLatch(1);
126          Thread t1 = newStartedThread(new CheckedInterruptedRunnable() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines