# HG changeset patch # User Jaroslav Tulach # Date 1359732357 -3600 # Node ID e5cc7edead2559896fb14c9278a6ac8ca81a1e7c # Parent 80532cda61757186c31099d1327de99816fe16c6 David's classes can be compiled diff -r 80532cda6175 -r e5cc7edead25 emul/compact/src/main/java/java/util/PriorityQueue.java --- a/emul/compact/src/main/java/java/util/PriorityQueue.java Fri Feb 01 16:10:51 2013 +0100 +++ b/emul/compact/src/main/java/java/util/PriorityQueue.java Fri Feb 01 16:25:57 2013 +0100 @@ -25,6 +25,8 @@ package java.util; +import org.apidesign.bck2brwsr.emul.lang.System; + /** * An unbounded priority {@linkplain Queue queue} based on a priority heap. * The elements of the priority queue are ordered according to their @@ -726,50 +728,5 @@ return comparator; } - /** - * Saves the state of the instance to a stream (that - * is, serializes it). - * - * @serialData The length of the array backing the instance is - * emitted (int), followed by all of its elements - * (each an {@code Object}) in the proper order. - * @param s the stream - */ - private void writeObject(java.io.ObjectOutputStream s) - throws java.io.IOException{ - // Write out element count, and any hidden stuff - s.defaultWriteObject(); - // Write out array length, for compatibility with 1.5 version - s.writeInt(Math.max(2, size + 1)); - - // Write out all elements in the "proper order". - for (int i = 0; i < size; i++) - s.writeObject(queue[i]); - } - - /** - * Reconstitutes the {@code PriorityQueue} instance from a stream - * (that is, deserializes it). - * - * @param s the stream - */ - private void readObject(java.io.ObjectInputStream s) - throws java.io.IOException, ClassNotFoundException { - // Read in size, and any hidden stuff - s.defaultReadObject(); - - // Read in (and discard) array length - s.readInt(); - - queue = new Object[size]; - - // Read in all elements. - for (int i = 0; i < size; i++) - queue[i] = s.readObject(); - - // Elements are guaranteed to be in "proper order", but the - // spec has never explained what that might be. - heapify(); - } } diff -r 80532cda6175 -r e5cc7edead25 emul/compact/src/main/java/java/util/concurrent/TimeUnit.java --- a/emul/compact/src/main/java/java/util/concurrent/TimeUnit.java Fri Feb 01 16:10:51 2013 +0100 +++ b/emul/compact/src/main/java/java/util/concurrent/TimeUnit.java Fri Feb 01 16:25:57 2013 +0100 @@ -334,14 +334,14 @@ * or equal to zero, do not wait at all. * @throws InterruptedException if interrupted while waiting */ - public void timedJoin(Thread thread, long timeout) - throws InterruptedException { - if (timeout > 0) { - long ms = toMillis(timeout); - int ns = excessNanos(timeout, ms); - thread.join(ms, ns); - } - } +// public void timedJoin(Thread thread, long timeout) +// throws InterruptedException { +// if (timeout > 0) { +// long ms = toMillis(timeout); +// int ns = excessNanos(timeout, ms); +// thread.join(ms, ns); +// } +// } /** * Performs a {@link Thread#sleep(long, int) Thread.sleep} using @@ -357,7 +357,10 @@ if (timeout > 0) { long ms = toMillis(timeout); int ns = excessNanos(timeout, ms); - Thread.sleep(ms, ns); + Object o = new Object(); + synchronized (o) { + o.wait(ms, ns); + } } }