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

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.86 by jsr166, Mon May 30 22:42:22 2011 UTC vs.
Revision 1.88 by jsr166, Tue May 31 15:01:24 2011 UTC

# Line 690 | Line 690 | public class JSR166TestCase extends Test
690      }
691  
692      /**
693 <     * Waits up to the specified number of milliseconds for the given
693 >     * Spin-waits up to the specified number of milliseconds for the given
694       * thread to enter a wait state: BLOCKED, WAITING, or TIMED_WAITING.
695       */
696      void waitForThreadToEnterWaitState(Thread thread, long timeoutMillis) {
697 <        long timeoutNanos = timeoutMillis * 1000L * 1000L;
698 <        long t0 = System.nanoTime();
697 >        long startTime = System.nanoTime();
698          for (;;) {
699              Thread.State s = thread.getState();
700              if (s == Thread.State.BLOCKED ||
# Line 704 | Line 703 | public class JSR166TestCase extends Test
703                  return;
704              else if (s == Thread.State.TERMINATED)
705                  fail("Unexpected thread termination");
706 <            else if (System.nanoTime() - t0 > timeoutNanos) {
706 >            else if (millisElapsedSince(startTime) > timeoutMillis) {
707                  threadAssertTrue(thread.isAlive());
708                  return;
709              }
# Line 1181 | Line 1180 | public class JSR166TestCase extends Test
1180              oos.writeObject(o);
1181              oos.flush();
1182              oos.close();
1183 <            ByteArrayInputStream bin =
1184 <                new ByteArrayInputStream(bos.toByteArray());
1185 <            ObjectInputStream ois = new ObjectInputStream(bin);
1186 <            return (T) ois.readObject();
1183 >            ObjectInputStream ois = new ObjectInputStream
1184 >                (new ByteArrayInputStream(bos.toByteArray()));
1185 >            T clone = (T) ois.readObject();
1186 >            assertSame(o.getClass(), clone.getClass());
1187 >            return clone;
1188          } catch (Throwable t) {
1189              threadUnexpectedException(t);
1190              return null;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines