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

Comparing jsr166/src/test/tck/ScheduledExecutorSubclassTest.java (file contents):
Revision 1.19 by jsr166, Tue Mar 15 19:47:07 2011 UTC vs.
Revision 1.21 by dl, Fri May 6 11:22:07 2011 UTC

# Line 203 | Line 203 | public class ScheduledExecutorSubclassTe
203          RunnableCounter counter = new RunnableCounter();
204          ScheduledFuture h =
205              p.scheduleAtFixedRate(counter, 0, 1, MILLISECONDS);
206 <        Thread.sleep(SMALL_DELAY_MS);
206 >        delay(SMALL_DELAY_MS);
207          h.cancel(true);
208          int c = counter.count.get();
209          // By time scaling conventions, we must have at least
# Line 221 | Line 221 | public class ScheduledExecutorSubclassTe
221          RunnableCounter counter = new RunnableCounter();
222          ScheduledFuture h =
223              p.scheduleWithFixedDelay(counter, 0, 1, MILLISECONDS);
224 <        Thread.sleep(SMALL_DELAY_MS);
224 >        delay(SMALL_DELAY_MS);
225          h.cancel(true);
226          int c = counter.count.get();
227          assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS);
# Line 291 | Line 291 | public class ScheduledExecutorSubclassTe
291      /**
292       * schedule callable throws RejectedExecutionException if shutdown
293       */
294 <     public void testSchedule3_RejectedExecutionException() {
295 <         CustomExecutor se = new CustomExecutor(1);
296 <         try {
297 <             se.shutdown();
298 <             se.schedule(new NoOpCallable(),
299 <                         MEDIUM_DELAY_MS, MILLISECONDS);
300 <             shouldThrow();
301 <         } catch (RejectedExecutionException success) {
302 <         } catch (SecurityException ok) {
303 <         }
304 <         joinPool(se);
294 >    public void testSchedule3_RejectedExecutionException() {
295 >        CustomExecutor se = new CustomExecutor(1);
296 >        try {
297 >            se.shutdown();
298 >            se.schedule(new NoOpCallable(),
299 >                        MEDIUM_DELAY_MS, MILLISECONDS);
300 >            shouldThrow();
301 >        } catch (RejectedExecutionException success) {
302 >        } catch (SecurityException ok) {
303 >        }
304 >        joinPool(se);
305      }
306  
307      /**
# Line 382 | Line 382 | public class ScheduledExecutorSubclassTe
382              assertEquals(0, p.getCompletedTaskCount());
383              threadProceed.countDown();
384              threadDone.await();
385 <            Thread.sleep(SHORT_DELAY_MS);
385 >            delay(SHORT_DELAY_MS);
386              assertEquals(1, p.getCompletedTaskCount());
387          } finally {
388              joinPool(p);
# Line 657 | Line 657 | public class ScheduledExecutorSubclassTe
657                  long count = p.getTaskCount();
658                  if (count >= 0 && count <= max)
659                      break;
660 <                Thread.sleep(1);
660 >                delay(1);
661              }
662              assertTrue(k < SMALL_DELAY_MS);
663          } finally {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines