ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Collections/RacingCollections.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Collections/RacingCollections.java (file contents):
Revision 1.3 by jsr166, Sun Sep 5 21:32:19 2010 UTC vs.
Revision 1.5 by jsr166, Tue Dec 6 04:37:55 2011 UTC

# Line 38 | Line 38 | public class RacingCollections {
38       * Turn this up to some higher value like 1000 for stress testing:
39       * java -Dmillis=1000 RacingCollections
40       */
41 <    final static long defaultWorkTimeMillis = Long.getLong("millis", 10L);
41 >    static final long defaultWorkTimeMillis = Long.getLong("millis", 10L);
42  
43      /**
44       * Whether to print debug information.
45       */
46 <    final static boolean debug = Boolean.getBoolean("debug");
46 >    static final boolean debug = Boolean.getBoolean("debug");
47  
48 <    final static Integer one = 1;
49 <    final static Integer two = 2;
48 >    static final Integer one = 1;
49 >    static final Integer two = 2;
50  
51      /**
52       * A thread that mutates an object forever, alternating between
# Line 62 | Line 62 | public class RacingCollections {
62              this.start();
63          }
64  
65 <        @SuppressWarnings("unchecked") void clear(Object o) {
65 >        @SuppressWarnings("unchecked")
66 >        void clear(Object o) {
67              if (o instanceof Collection)
68                  ((Collection<?>)o).clear();
69              else
70                  ((Map<?,?>)o).clear();
71          }
72  
73 <        @SuppressWarnings("unchecked") void realRun() {
73 >        @SuppressWarnings("unchecked")
74 >        void realRun() {
75              // Mutate elLoco wildly forever, checking occasionally for "done"
76              clear(elLoco);
77              if (elLoco instanceof List) {
# Line 340 | Line 342 | public class RacingCollections {
342          try {realMain(args);} catch (Throwable t) {unexpected(t);}
343          System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
344          if (failed > 0) throw new AssertionError("Some tests failed");}
345 <    private static abstract class CheckedThread extends Thread {
345 >    private abstract static class CheckedThread extends Thread {
346          abstract void realRun() throws Throwable;
347          public void run() {
348              try { realRun(); } catch (Throwable t) { unexpected(t); }}}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines