1.1 --- a/emul/compact/src/main/java/java/util/PriorityQueue.java Fri Feb 01 16:10:51 2013 +0100
1.2 +++ b/emul/compact/src/main/java/java/util/PriorityQueue.java Fri Feb 01 16:25:57 2013 +0100
1.3 @@ -25,6 +25,8 @@
1.4
1.5 package java.util;
1.6
1.7 +import org.apidesign.bck2brwsr.emul.lang.System;
1.8 +
1.9 /**
1.10 * An unbounded priority {@linkplain Queue queue} based on a priority heap.
1.11 * The elements of the priority queue are ordered according to their
1.12 @@ -726,50 +728,5 @@
1.13 return comparator;
1.14 }
1.15
1.16 - /**
1.17 - * Saves the state of the instance to a stream (that
1.18 - * is, serializes it).
1.19 - *
1.20 - * @serialData The length of the array backing the instance is
1.21 - * emitted (int), followed by all of its elements
1.22 - * (each an {@code Object}) in the proper order.
1.23 - * @param s the stream
1.24 - */
1.25 - private void writeObject(java.io.ObjectOutputStream s)
1.26 - throws java.io.IOException{
1.27 - // Write out element count, and any hidden stuff
1.28 - s.defaultWriteObject();
1.29
1.30 - // Write out array length, for compatibility with 1.5 version
1.31 - s.writeInt(Math.max(2, size + 1));
1.32 -
1.33 - // Write out all elements in the "proper order".
1.34 - for (int i = 0; i < size; i++)
1.35 - s.writeObject(queue[i]);
1.36 - }
1.37 -
1.38 - /**
1.39 - * Reconstitutes the {@code PriorityQueue} instance from a stream
1.40 - * (that is, deserializes it).
1.41 - *
1.42 - * @param s the stream
1.43 - */
1.44 - private void readObject(java.io.ObjectInputStream s)
1.45 - throws java.io.IOException, ClassNotFoundException {
1.46 - // Read in size, and any hidden stuff
1.47 - s.defaultReadObject();
1.48 -
1.49 - // Read in (and discard) array length
1.50 - s.readInt();
1.51 -
1.52 - queue = new Object[size];
1.53 -
1.54 - // Read in all elements.
1.55 - for (int i = 0; i < size; i++)
1.56 - queue[i] = s.readObject();
1.57 -
1.58 - // Elements are guaranteed to be in "proper order", but the
1.59 - // spec has never explained what that might be.
1.60 - heapify();
1.61 - }
1.62 }
2.1 --- a/emul/compact/src/main/java/java/util/concurrent/TimeUnit.java Fri Feb 01 16:10:51 2013 +0100
2.2 +++ b/emul/compact/src/main/java/java/util/concurrent/TimeUnit.java Fri Feb 01 16:25:57 2013 +0100
2.3 @@ -334,14 +334,14 @@
2.4 * or equal to zero, do not wait at all.
2.5 * @throws InterruptedException if interrupted while waiting
2.6 */
2.7 - public void timedJoin(Thread thread, long timeout)
2.8 - throws InterruptedException {
2.9 - if (timeout > 0) {
2.10 - long ms = toMillis(timeout);
2.11 - int ns = excessNanos(timeout, ms);
2.12 - thread.join(ms, ns);
2.13 - }
2.14 - }
2.15 +// public void timedJoin(Thread thread, long timeout)
2.16 +// throws InterruptedException {
2.17 +// if (timeout > 0) {
2.18 +// long ms = toMillis(timeout);
2.19 +// int ns = excessNanos(timeout, ms);
2.20 +// thread.join(ms, ns);
2.21 +// }
2.22 +// }
2.23
2.24 /**
2.25 * Performs a {@link Thread#sleep(long, int) Thread.sleep} using
2.26 @@ -357,7 +357,10 @@
2.27 if (timeout > 0) {
2.28 long ms = toMillis(timeout);
2.29 int ns = excessNanos(timeout, ms);
2.30 - Thread.sleep(ms, ns);
2.31 + Object o = new Object();
2.32 + synchronized (o) {
2.33 + o.wait(ms, ns);
2.34 + }
2.35 }
2.36 }
2.37